From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150649833485837.22165027803942; Wed, 27 Sep 2017 00:45:34 -0700 (PDT) Received: from localhost ([::1]:52992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx72A-0002sd-4p for importer@patchew.org; Wed, 27 Sep 2017 03:45:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70M-0001Qg-OD for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70I-0003zY-Be for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:38 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42333) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70H-0003vc-Vh; Wed, 27 Sep 2017 03:43:34 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vL45fTz9sRg; Wed, 27 Sep 2017 17:43:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498206; bh=RbQXr+tUi5x5nHMcz5kl4G92aS0FgxksVFmJe7HvnJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENPq3dH+a9Zesn93Bjh1Fl2yvHZ/JOKuf+OUzlPniIP0TRt1telTLC+p4s1s+TdNm 59fSZ2eNwhOoyk1EVnBaTox7H3LaTPmbr7R0hCoeq29/azU/yTSKnH5SsEueiL63vh XTHjfrN56YUZf6cVlo0UtuaFUNlXLiVVocs5++Xg= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:51 +1000 Message-Id: <20170927074316.4454-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 01/26] ppc/kvm: check some capabilities with kvm_vm_check_extension() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz The following capabilities are VM specific: - KVM_CAP_PPC_SMT_POSSIBLE - KVM_CAP_PPC_HTAB_FD - KVM_CAP_PPC_ALLOC_HTAB If both KVM HV and KVM PR are present, checking them always return the HV value, even if we explicitely requested to use PR. This has no visible effect for KVM_CAP_PPC_ALLOC_HTAB, because we also try the KVM_PPC_ALLOCATE_HTAB ioctl which is only suppored by HV. As a consequence, the spapr code doesn't even check KVM_CAP_PPC_HTAB_FD. However, this will cause kvmppc_hint_smt_possible(), introduced by commit fa98fbfcdfcb9, to report several VSMT modes (eg, Available VSMT modes: 8 4 2 1) whereas PR only support mode 1. This patch fixes all three anyway to use kvm_vm_check_extension(). It is okay since the VM is already created at the time kvm_arch_init() or kvmppc_reset_htab() is called. Signed-off-by: Greg Kurz Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/kvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 1deaf106d2..208c70e814 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -131,7 +131,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_interrupt_level =3D kvm_check_extension(s, KVM_CAP_PPC_IRQ_LEVEL); cap_segstate =3D kvm_check_extension(s, KVM_CAP_PPC_SEGSTATE); cap_booke_sregs =3D kvm_check_extension(s, KVM_CAP_PPC_BOOKE_SREGS); - cap_ppc_smt_possible =3D kvm_check_extension(s, KVM_CAP_PPC_SMT_POSSIB= LE); + cap_ppc_smt_possible =3D kvm_vm_check_extension(s, KVM_CAP_PPC_SMT_POS= SIBLE); cap_ppc_rma =3D kvm_check_extension(s, KVM_CAP_PPC_RMA); cap_spapr_tce =3D kvm_check_extension(s, KVM_CAP_SPAPR_TCE); cap_spapr_tce_64 =3D kvm_check_extension(s, KVM_CAP_SPAPR_TCE_64); @@ -143,7 +143,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_ppc_watchdog =3D kvm_check_extension(s, KVM_CAP_PPC_BOOKE_WATCHDOG= ); /* Note: we don't set cap_papr here, because this capability is * only activated after this by kvmppc_set_papr() */ - cap_htab_fd =3D kvm_check_extension(s, KVM_CAP_PPC_HTAB_FD); + cap_htab_fd =3D kvm_vm_check_extension(s, KVM_CAP_PPC_HTAB_FD); cap_fixup_hcalls =3D kvm_check_extension(s, KVM_CAP_PPC_FIXUP_HCALL); cap_ppc_smt =3D kvm_vm_check_extension(s, KVM_CAP_PPC_SMT); cap_htm =3D kvm_vm_check_extension(s, KVM_CAP_PPC_HTM); @@ -2353,7 +2353,7 @@ int kvmppc_reset_htab(int shift_hint) /* Full emulation, tell caller to allocate htab itself */ return 0; } - if (kvm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) { + if (kvm_vm_check_extension(kvm_state, KVM_CAP_PPC_ALLOC_HTAB)) { int ret; ret =3D kvm_vm_ioctl(kvm_state, KVM_PPC_ALLOCATE_HTAB, &shift); if (ret =3D=3D -ENOTTY) { --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498328981996.7159295314325; Wed, 27 Sep 2017 00:45:28 -0700 (PDT) Received: from localhost ([::1]:52991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx728-0002r5-6E for importer@patchew.org; Wed, 27 Sep 2017 03:45:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70L-0001PC-BQ for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70I-0003z8-87 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:37 -0400 Received: from ozlabs.org ([103.22.144.67]:59321) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70H-0003vd-T3; Wed, 27 Sep 2017 03:43:34 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vL64wKz9t5l; Wed, 27 Sep 2017 17:43:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498206; bh=LWOV1W+O9YEgKrB8txGh0fkS5/JGTUfPLdKBttLX5DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OFli4v79hip/xrO9wddgtXjmOufkg30wi16gnEgL+4NMwY6lo2eDxj+BPAUvRVxYc C5RZONEmxoiBabebsXGHlIbWn6eSefqDu18d3OIeLUgvFjU4qECGMDBTf5X182N+Oq ZkJ32FpJP9ZkmROUwYRXuo+CPPPngMvBlFB8PRyc= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:52 +1000 Message-Id: <20170927074316.4454-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 02/26] ppc/kvm: drop kvmppc_has_cap_htab_fd() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz It never got used since its introduction (commit 7c43bca004af). Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- target/ppc/kvm.c | 5 ----- target/ppc/kvm_ppc.h | 6 ------ 2 files changed, 11 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 208c70e814..be27429b57 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2448,11 +2448,6 @@ bool kvmppc_has_cap_epr(void) return cap_epr; } =20 -bool kvmppc_has_cap_htab_fd(void) -{ - return cap_htab_fd; -} - bool kvmppc_has_cap_fixup_hcalls(void) { return cap_fixup_hcalls; diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index f780e6ec7b..08aab46c5a 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -51,7 +51,6 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned = int hash_shift); #endif /* !CONFIG_USER_ONLY */ bool kvmppc_has_cap_epr(void); int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function); -bool kvmppc_has_cap_htab_fd(void); int kvmppc_get_htab_fd(bool write); int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns); int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, @@ -246,11 +245,6 @@ static inline int kvmppc_define_rtas_kernel_token(uint= 32_t token, return -1; } =20 -static inline bool kvmppc_has_cap_htab_fd(void) -{ - return false; -} - static inline int kvmppc_get_htab_fd(bool write) { return -1; --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498523055125.53808977342987; Wed, 27 Sep 2017 00:48:43 -0700 (PDT) Received: from localhost ([::1]:53011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx75A-0005Yw-Fj for importer@patchew.org; Wed, 27 Sep 2017 03:48:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70J-0001NN-1A for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70H-0003yr-VC for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:35 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:45833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70H-0003vi-JQ; Wed, 27 Sep 2017 03:43:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vL70yNz9t5x; Wed, 27 Sep 2017 17:43:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498206; bh=SulTgyqrv5JFxt49k3H0DgXOJqLYV3lGen7XNg5/HKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YBGqqdDdLkONw7gQgsyC/yhugKzLCk9EPTw+1GSUfR8NKZaMzzU+ngPkaEI0EahWa kZHAWE4Ni7rHnGzA9UqxtAZ4Gf6CBjx5Yt7SvrdeMvB/sIerDrx0f1oE+foADz7jQH HUb2s0nszfLVUVvf0/rNia8H4HF4eXPUpzVn5PMo= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:53 +1000 Message-Id: <20170927074316.4454-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 03/26] ohci: Allow sysbus version to be used as a companion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Some PPC SoCs have an EHCI with OHCI companion USB controller. To emulate this allow the sysbus version of OHCI to be used as a companion. Signed-off-by: BALATON Zoltan Reviewed-by: David Gibson Reviewed-by: Gerd Hoffmann Signed-off-by: David Gibson --- hw/usb/hcd-ohci.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 267982e160..17beeddb09 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1999,7 +1999,9 @@ typedef struct { /*< public >*/ =20 OHCIState ohci; + char *masterbus; uint32_t num_ports; + uint32_t firstport; dma_addr_t dma_offset; } OHCISysBusState; =20 @@ -2007,10 +2009,15 @@ static void ohci_realize_pxa(DeviceState *dev, Erro= r **errp) { OHCISysBusState *s =3D SYSBUS_OHCI(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + Error *err =3D NULL; =20 - /* Cannot fail as we pass NULL for masterbus */ - usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, NULL, 0, - &address_space_memory, &error_abort); + usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, + s->masterbus, s->firstport, + &address_space_memory, &err); + if (err) { + error_propagate(errp, err); + return; + } sysbus_init_irq(sbd, &s->ohci.irq); sysbus_init_mmio(sbd, &s->ohci.mem); } @@ -2142,7 +2149,9 @@ static const TypeInfo ohci_pci_info =3D { }; =20 static Property ohci_sysbus_properties[] =3D { + DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus), DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3), + DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0), DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 0), DEFINE_PROP_END_OF_LIST(), }; --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498352857828.1955422381969; Wed, 27 Sep 2017 00:45:52 -0700 (PDT) Received: from localhost ([::1]:52998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx72W-0003K3-4p for importer@patchew.org; Wed, 27 Sep 2017 03:45:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70J-0001NI-0W for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70H-0003ym-Uf for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:35 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:38481) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70H-0003vv-JR; Wed, 27 Sep 2017 03:43:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vM2Vzbz9t66; Wed, 27 Sep 2017 17:43:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498207; bh=lLX4d1/L78jrxSxPjTnfbzjM2kfDL1FSubgs3rwqAco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kuvWhrzH/+BUX+ZYLrVi+ZXe1oWVrGtMt45LNUOm+kbJaljpoebCDdCgBfPPhGrjp boLcFsDPmBZ0IQNGDnW3KUn5Czwn+qpjJ1lmBnF9/rsj0N+BlN6nPXHEINt6rb1Dhf +5K0lyhzqNzykAXo3HBScp1z5wPFwjNeJOlQMnnY= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:54 +1000 Message-Id: <20170927074316.4454-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 04/26] ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Some PPC SoCs have an EHCI with OHCI companion USB controller. Add a new type for this similar to types used for other embedded SoCs. Signed-off-by: BALATON Zoltan Reviewed-by: David Gibson Reviewed-by: Gerd Hoffmann Signed-off-by: David Gibson --- hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++ hw/usb/hcd-ehci.h | 1 + 2 files changed, 26 insertions(+) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 6c20604d07..3b83beb140 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -142,6 +142,30 @@ static const TypeInfo ehci_tegra2_type_info =3D { .class_init =3D ehci_tegra2_class_init, }; =20 +static void ehci_ppc4xx_init(Object *o) +{ + EHCISysBusState *s =3D SYS_BUS_EHCI(o); + + s->ehci.companion_enable =3D true; +} + +static void ehci_ppc4xx_class_init(ObjectClass *oc, void *data) +{ + SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); + DeviceClass *dc =3D DEVICE_CLASS(oc); + + sec->capsbase =3D 0x0; + sec->opregbase =3D 0x10; + set_bit(DEVICE_CATEGORY_USB, dc->categories); +} + +static const TypeInfo ehci_ppc4xx_type_info =3D { + .name =3D TYPE_PPC4xx_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_ppc4xx_class_init, + .instance_init =3D ehci_ppc4xx_init, +}; + /* * Faraday FUSBH200 USB 2.0 EHCI */ @@ -224,6 +248,7 @@ static void ehci_sysbus_register_types(void) type_register_static(&ehci_xlnx_type_info); type_register_static(&ehci_exynos4210_type_info); type_register_static(&ehci_tegra2_type_info); + type_register_static(&ehci_ppc4xx_type_info); type_register_static(&ehci_fusbh200_type_info); } =20 diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 821f1ded43..0bc364b286 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -344,6 +344,7 @@ typedef struct EHCIPCIState { #define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" #define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb" #define TYPE_TEGRA2_EHCI "tegra2-ehci-usb" +#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb" #define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb" =20 #define SYS_BUS_EHCI(obj) \ --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498523451739.7651614680086; Wed, 27 Sep 2017 00:48:43 -0700 (PDT) Received: from localhost ([::1]:53010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx753-0005UG-KM for importer@patchew.org; Wed, 27 Sep 2017 03:48:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70M-0001Qc-LS for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-00043R-Cx for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:38 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:58949) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-0003zf-0M; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vM4S7rz9tXC; Wed, 27 Sep 2017 17:43:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498207; bh=60sJ4q+BaJlYgqGX6PfN+JcdmtdMkccKaD3VM7YJEyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/Q8p3j7it+t+g0X0rrBn+i3bGlYUdHRDfxCjlHulnbPO7zEg7vg44VobSR3X7/+H LjlXW2woW9gXEOw7PK0jlVZSa4lQabz4hm0mKZCK53aWG1q9utPwmGNMw4dAjDBnGN Lujwx7iGHwqBvPtJJXqCl+YhPIsr4lfZl5UjaKo8= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:55 +1000 Message-Id: <20170927074316.4454-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 05/26] ppc: Add 460EX embedded CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Despite its name it is a 440 core CPU Signed-off-by: BALATON Zoltan Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/cpu-models.c | 3 +++ target/ppc/cpu-models.h | 1 + target/ppc/translate_init.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index 9626d6b7c4..9d45702843 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -167,6 +167,8 @@ "PowerPC 440 EPb") POWERPC_DEF("440epx", CPU_POWERPC_440EPX, 440EP, "PowerPC 440 EPX") + POWERPC_DEF("460exb", CPU_POWERPC_460EXb, 460EX, + "PowerPC 460 EXb") #if defined(TODO_USER_ONLY) POWERPC_DEF("440gpb", CPU_POWERPC_440GPb, 440GP, "PowerPC 440 GPb") @@ -786,6 +788,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] =3D { { "x2vp50", "x2vp20" }, =20 { "440ep", "440epb" }, + { "460ex", "460exb" }, #if defined(TODO_USER_ONLY) { "440gp", "440gpc" }, { "440gr", "440gra" }, diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index df31d7f492..ed64005ff8 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -240,6 +240,7 @@ enum { CPU_POWERPC_440SP =3D 0x53221850, CPU_POWERPC_440SP2 =3D 0x53221891, CPU_POWERPC_440SPE =3D 0x53421890, + CPU_POWERPC_460EXb =3D 0x130218A4, /* called 460 but 440 c= ore */ /* PowerPC 460 family */ #if 0 /* Generic PowerPC 464 */ diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 466bf97347..c6399a3a0d 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -3833,6 +3833,44 @@ POWERPC_FAMILY(440EP)(ObjectClass *oc, void *data) POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; } =20 +POWERPC_FAMILY(460EX)(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); + + dc->desc =3D "PowerPC 460 EX"; + pcc->init_proc =3D init_proc_440EP; + pcc->check_pow =3D check_pow_nocheck; + pcc->insns_flags =3D PPC_INSNS_BASE | PPC_STRING | + PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL | + PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | + PPC_FLOAT_STFIWX | + PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_RFMCI | + PPC_CACHE | PPC_CACHE_ICBI | + PPC_CACHE_DCBZ | PPC_CACHE_DCBA | + PPC_MEM_TLBSYNC | PPC_MFTB | + PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | + PPC_440_SPEC; + pcc->msr_mask =3D (1ull << MSR_POW) | + (1ull << MSR_CE) | + (1ull << MSR_EE) | + (1ull << MSR_PR) | + (1ull << MSR_FP) | + (1ull << MSR_ME) | + (1ull << MSR_FE0) | + (1ull << MSR_DWE) | + (1ull << MSR_DE) | + (1ull << MSR_FE1) | + (1ull << MSR_IR) | + (1ull << MSR_DR); + pcc->mmu_model =3D POWERPC_MMU_BOOKE; + pcc->excp_model =3D POWERPC_EXCP_BOOKE; + pcc->bus_model =3D PPC_FLAGS_INPUT_BookE; + pcc->bfd_mach =3D bfd_mach_ppc_403; + pcc->flags =3D POWERPC_FLAG_CE | POWERPC_FLAG_DWE | + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK; +} + static void init_proc_440GP(CPUPPCState *env) { /* Time base */ --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498523055544.1392001476997; Wed, 27 Sep 2017 00:48:43 -0700 (PDT) Received: from localhost ([::1]:53009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx753-0005T0-2g for importer@patchew.org; Wed, 27 Sep 2017 03:48:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70M-0001Pt-4t for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-000431-31 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:38 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:43905) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70K-0003zg-OO; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vM6B45z9tXF; Wed, 27 Sep 2017 17:43:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498207; bh=l4MhnrvN2HO7n7xTyPEe4/R0ghHhQxXGRE2SknGN0LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mr/GEmuN493PEeR+LpzwB+QqAG1WR6+CubC9aerBqKyLefQDTyexn489Pl9Qqu91U kpCB65hCxnib+KDoILhOzBUmIZa4NcNR0GvE7JOZfqR4wo4wvg/LaYaRVb/4FyzYQH mzjroXzn9OGFIjtyHeUXWlmgqfzEsf8da77XCXa0= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:56 +1000 Message-Id: <20170927074316.4454-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 06/26] ppc4xx: Add more PLB registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan These registers are present in 440 SoCs (and maybe in others too) and U-Boot accesses them when printing register info. We don't emulate these but add them to avoid crashing when they are read or written. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/ppc/ppc405_uc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index e621d0aec5..8e58065f5f 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -105,9 +105,12 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4= xx_bd_info_t *bd, /*************************************************************************= ****/ /* Peripheral local bus arbitrer */ enum { - PLB0_BESR =3D 0x084, - PLB0_BEAR =3D 0x086, - PLB0_ACR =3D 0x087, + PLB3A0_ACR =3D 0x077, + PLB4A0_ACR =3D 0x081, + PLB0_BESR =3D 0x084, + PLB0_BEAR =3D 0x086, + PLB0_ACR =3D 0x087, + PLB4A1_ACR =3D 0x089, }; =20 typedef struct ppc4xx_plb_t ppc4xx_plb_t; @@ -179,9 +182,12 @@ void ppc4xx_plb_init(CPUPPCState *env) ppc4xx_plb_t *plb; =20 plb =3D g_malloc0(sizeof(ppc4xx_plb_t)); + ppc_dcr_register(env, PLB3A0_ACR, plb, &dcr_read_plb, &dcr_write_plb); + ppc_dcr_register(env, PLB4A0_ACR, plb, &dcr_read_plb, &dcr_write_plb); ppc_dcr_register(env, PLB0_ACR, plb, &dcr_read_plb, &dcr_write_plb); ppc_dcr_register(env, PLB0_BEAR, plb, &dcr_read_plb, &dcr_write_plb); ppc_dcr_register(env, PLB0_BESR, plb, &dcr_read_plb, &dcr_write_plb); + ppc_dcr_register(env, PLB4A1_ACR, plb, &dcr_read_plb, &dcr_write_plb); qemu_register_reset(ppc4xx_plb_reset, plb); } =20 --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499028456747.3264978395387; Wed, 27 Sep 2017 00:57:08 -0700 (PDT) Received: from localhost ([::1]:53076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7DM-0004fz-Ot for importer@patchew.org; Wed, 27 Sep 2017 03:57:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70R-0001Wl-Vv for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-000443-O4 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:43 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:59981) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-0003zs-BN; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN0038z9tXG; Wed, 27 Sep 2017 17:43:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=YMmCgq3GdYeJWvmYB8TJ8lKBiCittELRkU2Bc9BYEdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RsYeCuh1HQtCr0LB4JkGsD7LFeIODh1GDSFX5MasP3XbyogxbZUf8mvrwHOqGq+TN O4aQ/PRCeZTzNZE2ckcesvdpUHH1G9quQTvOxlxtSlpQHxfcnsOQYS6/MR2dD6i3tf /rrtQ8YzasI3mh9Jo+nm3mhMaMEZsGvjQMc3uurU= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:57 +1000 Message-Id: <20170927074316.4454-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 07/26] ppc: QOMify g3beige machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/ppc/mac_oldworld.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 61838c3e6f..bc7c8b7bd7 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -371,8 +371,10 @@ static int heathrow_kvm_type(const char *arg) return 2; } =20 -static void heathrow_machine_init(MachineClass *mc) +static void heathrow_class_init(ObjectClass *oc, void *data) { + MachineClass *mc =3D MACHINE_CLASS(oc); + mc->desc =3D "Heathrow based PowerMAC"; mc->init =3D ppc_heathrow_init; mc->block_default_type =3D IF_IDE; @@ -385,4 +387,15 @@ static void heathrow_machine_init(MachineClass *mc) mc->kvm_type =3D heathrow_kvm_type; } =20 -DEFINE_MACHINE("g3beige", heathrow_machine_init) +static const TypeInfo ppc_heathrow_machine_info =3D { + .name =3D MACHINE_TYPE_NAME("g3beige"), + .parent =3D TYPE_MACHINE, + .class_init =3D heathrow_class_init +}; + +static void ppc_heathrow_register_types(void) +{ + type_register_static(&ppc_heathrow_machine_info); +} + +type_init(ppc_heathrow_register_types); --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498707098323.7353481686134; Wed, 27 Sep 2017 00:51:47 -0700 (PDT) Received: from localhost ([::1]:53030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx78E-0008Bu-8s for importer@patchew.org; Wed, 27 Sep 2017 03:51:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70N-0001Rc-AH for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-00044K-Pc for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:39 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:41131) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-00040E-Cq; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN1FzLz9tXT; Wed, 27 Sep 2017 17:43:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=roF8/NhStU/710oF6YrqMx0qw1Vc9bgftis8J+pF6g4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MnLu4ZWpQFfMEpadzb7sudSJNi4WqPHMtGIwofhUql0fac7BuO2mOpYrOS1IOig+j 10CUbwUlHWtimcqOqBQTrgkZSPA8Ta2leqs5E6Hz2hIOI2wok+7tpnBTYNBClrnihI GC+3wp7hF95mfKH5QCoHjqy3JWsr2Ls8xSCljKl8= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:58 +1000 Message-Id: <20170927074316.4454-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 08/26] ppc/mac: Advertise a high clock frequency for NewWorld Macs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt We use 900Mhz, otherwise MacOS X 10.5 refuses to install. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- hw/ppc/mac_newworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index d013c412d6..6a2bce181a 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -77,7 +77,7 @@ #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 #define TBFREQ (100UL * 1000UL * 1000UL) -#define CLOCKFREQ (266UL * 1000UL * 1000UL) +#define CLOCKFREQ (900UL * 1000UL * 1000UL) #define BUSFREQ (100UL * 1000UL * 1000UL) =20 #define NDRV_VGA_FILENAME "qemu_vga.ndrv" --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499103205746.571632448428; Wed, 27 Sep 2017 00:58:23 -0700 (PDT) Received: from localhost ([::1]:53088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7EX-0005gX-6O for importer@patchew.org; Wed, 27 Sep 2017 03:58:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70P-0001U3-I0 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70M-00044x-DD for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from ozlabs.org ([103.22.144.67]:43717) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-000409-E5; Wed, 27 Sep 2017 03:43:38 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN0dQdz9tXM; Wed, 27 Sep 2017 17:43:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=8Ks2di3NVLUCJHCygQ5iNsVwmJ1X7MaU7K5qr1Yx9OI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kViB2T8XEuTZzs9kpQlxOEWsgn9yhJ0T1LVH6ARma7Ub8Sr7ss3Fez9dEaFKZ1wHl baznlsrnWAdz8JFnZw//Eg1hcdClWOwHpHtUEBt7qt50BIaEBT4Q1uf83Ihqr/GKvG Dy1CfNC9Qu6VGVn9BcR0ceOEI5ROSogps3BcoKXA= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:42:59 +1000 Message-Id: <20170927074316.4454-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 09/26] ppc/mac: More rework of the DBDMA emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt This completely reworks the handling of the control register according to my understanding of the HW and the spec. It should (hopefully ... still testing) fix a number of issues most notably cases of MacOS hanging. Also update dbdma_unassigned_rw() and dbdma_unassigned_flush() to have the expected behaviour now that flush is handled slightly differently. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/mac_dbdma.c | 191 +++++++++++++++++++++++++++++++++---------= ---- 1 file changed, 139 insertions(+), 52 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 15452b9a28..3fe507393f 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -96,9 +96,8 @@ static void dbdma_cmdptr_load(DBDMA_channel *ch) =20 static void dbdma_cmdptr_save(DBDMA_channel *ch) { - DBDMA_DPRINTFCH(ch, "dbdma_cmdptr_save 0x%08x\n", - ch->regs[DBDMA_CMDPTR_LO]); - DBDMA_DPRINTFCH(ch, "xfer_status 0x%08x res_count 0x%04x\n", + DBDMA_DPRINTFCH(ch, "-> update 0x%08x stat=3D0x%08x, res=3D0x%04x\n", + ch->regs[DBDMA_CMDPTR_LO], le16_to_cpu(ch->current.xfer_status), le16_to_cpu(ch->current.res_count)); dma_memory_write(&address_space_memory, ch->regs[DBDMA_CMDPTR_LO], @@ -166,15 +165,14 @@ static int conditional_wait(DBDMA_channel *ch) uint16_t sel_mask, sel_value; uint32_t status; int cond; - - DBDMA_DPRINTFCH(ch, "conditional_wait\n"); + int res =3D 0; =20 wait =3D le16_to_cpu(current->command) & WAIT_MASK; - switch(wait) { case WAIT_NEVER: /* don't wait */ return 0; case WAIT_ALWAYS: /* always wait */ + DBDMA_DPRINTFCH(ch, " [WAIT_ALWAYS]\n"); return 1; } =20 @@ -187,15 +185,19 @@ static int conditional_wait(DBDMA_channel *ch) =20 switch(wait) { case WAIT_IFSET: /* wait if condition bit is 1 */ - if (cond) - return 1; - return 0; + if (cond) { + res =3D 1; + } + DBDMA_DPRINTFCH(ch, " [WAIT_IFSET=3D%d]\n", res); + break; case WAIT_IFCLR: /* wait if condition bit is 0 */ - if (!cond) - return 1; - return 0; + if (!cond) { + res =3D 1; + } + DBDMA_DPRINTFCH(ch, " [WAIT_IFCLR=3D%d]\n", res); + break; } - return 0; + return res; } =20 static void next(DBDMA_channel *ch) @@ -226,8 +228,6 @@ static void conditional_branch(DBDMA_channel *ch) uint32_t status; int cond; =20 - DBDMA_DPRINTFCH(ch, "conditional_branch\n"); - /* check if we must branch */ =20 br =3D le16_to_cpu(current->command) & BR_MASK; @@ -237,6 +237,7 @@ static void conditional_branch(DBDMA_channel *ch) next(ch); return; case BR_ALWAYS: /* always branch */ + DBDMA_DPRINTFCH(ch, " [BR_ALWAYS]\n"); branch(ch); return; } @@ -250,16 +251,22 @@ static void conditional_branch(DBDMA_channel *ch) =20 switch(br) { case BR_IFSET: /* branch if condition bit is 1 */ - if (cond) + if (cond) { + DBDMA_DPRINTFCH(ch, " [BR_IFSET =3D 1]\n"); branch(ch); - else + } else { + DBDMA_DPRINTFCH(ch, " [BR_IFSET =3D 0]\n"); next(ch); + } return; case BR_IFCLR: /* branch if condition bit is 0 */ - if (!cond) + if (!cond) { + DBDMA_DPRINTFCH(ch, " [BR_IFCLR =3D 1]\n"); branch(ch); - else + } else { + DBDMA_DPRINTFCH(ch, " [BR_IFCLR =3D 0]\n"); next(ch); + } return; } } @@ -428,7 +435,7 @@ wait: =20 static void stop(DBDMA_channel *ch) { - ch->regs[DBDMA_STATUS] &=3D ~(ACTIVE|DEAD|FLUSH); + ch->regs[DBDMA_STATUS] &=3D ~(ACTIVE); =20 /* the stop command does not increment command pointer */ } @@ -471,18 +478,22 @@ static void channel_run(DBDMA_channel *ch) =20 switch (cmd) { case OUTPUT_MORE: + DBDMA_DPRINTFCH(ch, "* OUTPUT_MORE *\n"); start_output(ch, key, phy_addr, req_count, 0); return; =20 case OUTPUT_LAST: + DBDMA_DPRINTFCH(ch, "* OUTPUT_LAST *\n"); start_output(ch, key, phy_addr, req_count, 1); return; =20 case INPUT_MORE: + DBDMA_DPRINTFCH(ch, "* INPUT_MORE *\n"); start_input(ch, key, phy_addr, req_count, 0); return; =20 case INPUT_LAST: + DBDMA_DPRINTFCH(ch, "* INPUT_LAST *\n"); start_input(ch, key, phy_addr, req_count, 1); return; } @@ -508,10 +519,12 @@ static void channel_run(DBDMA_channel *ch) =20 switch (cmd) { case LOAD_WORD: + DBDMA_DPRINTFCH(ch, "* LOAD_WORD *\n"); load_word(ch, key, phy_addr, req_count); return; =20 case STORE_WORD: + DBDMA_DPRINTFCH(ch, "* STORE_WORD *\n"); store_word(ch, key, phy_addr, req_count); return; } @@ -562,43 +575,117 @@ void DBDMA_register_channel(void *dbdma, int nchan, = qemu_irq irq, ch->io.opaque =3D opaque; } =20 -static void -dbdma_control_write(DBDMA_channel *ch) +static void dbdma_control_write(DBDMA_channel *ch) { uint16_t mask, value; uint32_t status; + bool do_flush =3D false; =20 mask =3D (ch->regs[DBDMA_CONTROL] >> 16) & 0xffff; value =3D ch->regs[DBDMA_CONTROL] & 0xffff; =20 - value &=3D (RUN | PAUSE | FLUSH | WAKE | DEVSTAT); - + /* This is the status register which we'll update + * appropriately and store back + */ status =3D ch->regs[DBDMA_STATUS]; =20 - status =3D (value & mask) | (status & ~mask); + /* RUN and PAUSE are bits under SW control only + * FLUSH and WAKE are set by SW and cleared by HW + * DEAD, ACTIVE and BT are only under HW control + * + * We handle ACTIVE separately at the end of the + * logic to ensure all cases are covered. + */ =20 - if (status & WAKE) - status |=3D ACTIVE; - if (status & RUN) { - status |=3D ACTIVE; - status &=3D ~DEAD; + /* Setting RUN will tentatively activate the channel + */ + if ((mask & RUN) && (value & RUN)) { + status |=3D RUN; + DBDMA_DPRINTFCH(ch, " Setting RUN !\n"); + } + + /* Clearing RUN 1->0 will stop the channel */ + if ((mask & RUN) && !(value & RUN)) { + /* This has the side effect of clearing the DEAD bit */ + status &=3D ~(DEAD | RUN); + DBDMA_DPRINTFCH(ch, " Clearing RUN !\n"); + } + + /* Setting WAKE wakes up an idle channel if it's running + * + * Note: The doc doesn't say so but assume that only works + * on a channel whose RUN bit is set. + * + * We set WAKE in status, it's not terribly useful as it will + * be cleared on the next command fetch but it seems to mimmic + * the HW behaviour and is useful for the way we handle + * ACTIVE further down. + */ + if ((mask & WAKE) && (value & WAKE) && (status & RUN)) { + status |=3D WAKE; + DBDMA_DPRINTFCH(ch, " Setting WAKE !\n"); + } + + /* PAUSE being set will deactivate (or prevent activation) + * of the channel. We just copy it over for now, ACTIVE will + * be re-evaluated later. + */ + if (mask & PAUSE) { + status =3D (status & ~PAUSE) | (value & PAUSE); + DBDMA_DPRINTFCH(ch, " %sing PAUSE !\n", + (value & PAUSE) ? "sett" : "clear"); + } + + /* FLUSH is its own thing */ + if ((mask & FLUSH) && (value & FLUSH)) { + DBDMA_DPRINTFCH(ch, " Setting FLUSH !\n"); + /* We set flush directly in the status register, we do *NOT* + * set it in "status" so that it gets naturally cleared when + * we update the status register further down. That way it + * will be set only during the HW flush operation so it is + * visible to any completions happening during that time. + */ + ch->regs[DBDMA_STATUS] |=3D FLUSH; + do_flush =3D true; } - if (status & PAUSE) + + /* If either RUN or PAUSE is clear, so should ACTIVE be, + * otherwise, ACTIVE will be set if we modified RUN, PAUSE or + * set WAKE. That means that PAUSE was just cleared, RUN was + * just set or WAKE was just set. + */ + if ((status & PAUSE) || !(status & RUN)) { status &=3D ~ACTIVE; - if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) { - /* RUN is cleared */ - status &=3D ~(ACTIVE|DEAD); + DBDMA_DPRINTFCH(ch, " -> ACTIVE down !\n"); + + /* We stopped processing, we want the underlying HW command + * to complete *before* we clear the ACTIVE bit. Otherwise + * we can get into a situation where the command status will + * have RUN or ACTIVE not set which is going to confuse the + * MacOS driver. + */ + do_flush =3D true; + } else if (mask & (RUN | PAUSE)) { + status |=3D ACTIVE; + DBDMA_DPRINTFCH(ch, " -> ACTIVE up !\n"); + } else if ((mask & WAKE) && (value & WAKE)) { + status |=3D ACTIVE; + DBDMA_DPRINTFCH(ch, " -> ACTIVE up !\n"); } =20 - if ((status & FLUSH) && ch->flush) { + DBDMA_DPRINTFCH(ch, " new status=3D0x%08x\n", status); + + /* If we need to flush the underlying HW, do it now, this happens + * both on FLUSH commands and when stopping the channel for safety. + */ + if (do_flush && ch->flush) { ch->flush(&ch->io); - status &=3D ~FLUSH; } =20 - DBDMA_DPRINTFCH(ch, " status 0x%08x\n", status); - + /* Finally update the status register image */ ch->regs[DBDMA_STATUS] =3D status; =20 + /* If active, make sure the BH gets to run */ if (status & ACTIVE) { DBDMA_kick(dbdma_from_ch(ch)); } @@ -666,13 +753,9 @@ static uint64_t dbdma_read(void *opaque, hwaddr addr, =20 value =3D ch->regs[reg]; =20 - DBDMA_DPRINTFCH(ch, "readl 0x" TARGET_FMT_plx " =3D> 0x%08x\n", addr, = value); - DBDMA_DPRINTFCH(ch, "channel 0x%x reg 0x%x\n", - (uint32_t)addr >> DBDMA_CHANNEL_SHIFT, reg); - switch(reg) { case DBDMA_CONTROL: - value =3D 0; + value =3D ch->regs[DBDMA_STATUS]; break; case DBDMA_STATUS: case DBDMA_CMDPTR_LO: @@ -698,6 +781,10 @@ static uint64_t dbdma_read(void *opaque, hwaddr addr, break; } =20 + DBDMA_DPRINTFCH(ch, "readl 0x" TARGET_FMT_plx " =3D> 0x%08x\n", addr, = value); + DBDMA_DPRINTFCH(ch, "channel 0x%x reg 0x%x\n", + (uint32_t)addr >> DBDMA_CHANNEL_SHIFT, reg); + return value; } =20 @@ -776,28 +863,28 @@ static void dbdma_reset(void *opaque) static void dbdma_unassigned_rw(DBDMA_io *io) { DBDMA_channel *ch =3D io->channel; - qemu_log_mask(LOG_GUEST_ERROR, "%s: use of unassigned channel %d\n", - __func__, ch->channel); - ch->io.processing =3D false; -} - -static void dbdma_unassigned_flush(DBDMA_io *io) -{ - DBDMA_channel *ch =3D io->channel; dbdma_cmd *current =3D &ch->current; uint16_t cmd; qemu_log_mask(LOG_GUEST_ERROR, "%s: use of unassigned channel %d\n", __func__, ch->channel); + ch->io.processing =3D false; =20 cmd =3D le16_to_cpu(current->command) & COMMAND_MASK; if (cmd =3D=3D OUTPUT_MORE || cmd =3D=3D OUTPUT_LAST || cmd =3D=3D INPUT_MORE || cmd =3D=3D INPUT_LAST) { - current->xfer_status =3D cpu_to_le16(ch->regs[DBDMA_STATUS] | FLUS= H); + current->xfer_status =3D cpu_to_le16(ch->regs[DBDMA_STATUS]); current->res_count =3D cpu_to_le16(io->len); dbdma_cmdptr_save(ch); } } =20 +static void dbdma_unassigned_flush(DBDMA_io *io) +{ + DBDMA_channel *ch =3D io->channel; + qemu_log_mask(LOG_GUEST_ERROR, "%s: use of unassigned channel %d\n", + __func__, ch->channel); +} + void* DBDMA_init (MemoryRegion **dbdma_mem) { DBDMAState *s; --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150649868005558.37239123878999; Wed, 27 Sep 2017 00:51:20 -0700 (PDT) Received: from localhost ([::1]:53029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx77n-0007q2-96 for importer@patchew.org; Wed, 27 Sep 2017 03:51:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70N-0001RS-51 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-000444-Nn for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:39 -0400 Received: from ozlabs.org ([103.22.144.67]:52921) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-00040W-At; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN2bkNz9tXQ; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=W9DrjWX7e+5KiGl41dqw64DVmt2Dlpd3V5f9Ri0lorw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXrioUYrQ42vOe+QwDNM2Xy1t2xwf2C04TBDa7SINqnJrWh86YXgyjGHRXDW2dZmh Ri0w2yFOVmU4FqGicR/WIl18Ze7EpO4+74UDp6zB893CNV7XVK7dMTWaCvlLTbP1kz tKdVLMOWXyg9bLdpraF07vg7g+RYdJAiD14c+jLs= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:00 +1000 Message-Id: <20170927074316.4454-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 10/26] ppc/ide/macio: Add missing registers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt The timing register exists on all variants of MacIO IDE, we just store and return its value. The interrupts register only exists on KeyLargo but it doesn't hurt to have it. The lack of this register causes MacOS X to hangs under some circumstances. Both are 32-bit only. The HW might support smaller access sizes but no known OS uses them. Because the core IDE subsystem doesn't provide us with a way to query the main (level) interrupt state, nor do we have a way to know that DBDMA issued a (edge) interrupt, we reflect both through a private pair of qirq's in order to maintain the register state. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- hw/ide/macio.c | 44 +++++++++++++++++++++++++++++++++++++++++--- hw/ppc/mac.h | 6 +++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 9742c005d1..db5db390e7 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -331,6 +331,12 @@ static void pmac_ide_writel (void *opaque, val =3D bswap32(val); if (addr =3D=3D 0) { ide_data_writel(&d->bus, 0, val); + } else if (addr =3D=3D 0x20) { + d->timing_reg =3D val; + } else if (addr =3D=3D 0x30) { + if (val & 0x80000000u) { + d->irq_reg &=3D 0x7fffffff; + } } } =20 @@ -342,6 +348,17 @@ static uint32_t pmac_ide_readl (void *opaque,hwaddr ad= dr) addr =3D (addr & 0xFFF) >> 4; if (addr =3D=3D 0) { retval =3D ide_data_readl(&d->bus, 0); + } else if (addr =3D=3D 0x20) { + retval =3D d->timing_reg; + } else if (addr =3D=3D 0x30) { + /* This is an interrupt state register that only exists + * in the KeyLargo and later variants. Bit 0x8000_0000 + * latches the DMA interrupt and has to be written to + * clear. Bit 0x4000_0000 is an image of the disk + * interrupt. MacOS X relies on this and will hang if + * we don't provide at least the disk interrupt + */ + retval =3D d->irq_reg; } else { retval =3D 0xFFFFFFFF; } @@ -426,13 +443,32 @@ static void macio_ide_realizefn(DeviceState *dev, Err= or **errp) { MACIOIDEState *s =3D MACIO_IDE(dev); =20 - ide_init2(&s->bus, s->irq); + ide_init2(&s->bus, s->ide_irq); =20 /* Register DMA callbacks */ s->dma.ops =3D &dbdma_ops; s->bus.dma =3D &s->dma; } =20 +static void pmac_ide_irq(void *opaque, int n, int level) +{ + MACIOIDEState *s =3D opaque; + uint32_t mask =3D 0x80000000u >> n; + + /* We need to reflect the IRQ state in the irq register */ + if (level) { + s->irq_reg |=3D mask; + } else { + s->irq_reg &=3D ~mask; + } + + if (n) { + qemu_set_irq(s->real_ide_irq, level); + } else { + qemu_set_irq(s->real_dma_irq, level); + } +} + static void macio_ide_initfn(Object *obj) { SysBusDevice *d =3D SYS_BUS_DEVICE(obj); @@ -441,8 +477,10 @@ static void macio_ide_initfn(Object *obj) ide_bus_new(&s->bus, sizeof(s->bus), DEVICE(obj), 0, 2); memory_region_init_io(&s->mem, obj, &pmac_ide_ops, s, "pmac-ide", 0x10= 00); sysbus_init_mmio(d, &s->mem); - sysbus_init_irq(d, &s->irq); - sysbus_init_irq(d, &s->dma_irq); + sysbus_init_irq(d, &s->real_ide_irq); + sysbus_init_irq(d, &s->real_dma_irq); + s->dma_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 0); + s->ide_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 1); } =20 static void macio_ide_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 20cbddb4e4..300fc8ab68 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -132,7 +132,9 @@ typedef struct MACIOIDEState { SysBusDevice parent_obj; /*< public >*/ =20 - qemu_irq irq; + qemu_irq real_ide_irq; + qemu_irq real_dma_irq; + qemu_irq ide_irq; qemu_irq dma_irq; =20 MemoryRegion mem; @@ -140,6 +142,8 @@ typedef struct MACIOIDEState { IDEDMA dma; void *dbdma; bool dma_active; + uint32_t timing_reg; + uint32_t irq_reg; } MACIOIDEState; =20 void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498849773773.3648816747047; Wed, 27 Sep 2017 00:54:09 -0700 (PDT) Received: from localhost ([::1]:53044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7AJ-0001v1-NT for importer@patchew.org; Wed, 27 Sep 2017 03:53:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70N-0001RK-1t for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-00043v-MC for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:39 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:46077) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-00040U-9T; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN4s2zz9tXg; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=ok+OBOGmK5m/AApfdGM6cSdVEgBMvRRZP79e77R+R/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FllWQXdOdPR/Aq8JnW5JHJS1B2KbzPdIUHEu2dqPCOIa0A17sYIxbHAs5NuLo6aIL XkcQtRm5Eh5Km9GmkC6CLO+YSIM7IhAbVARUMP8x7wCDjMiYeAsVlXYnXPr8hq2OMj pFjPp4HvMkqvZRA+1g2oblgG8y2byQ+QKoMZti5w= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:01 +1000 Message-Id: <20170927074316.4454-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 11/26] ppc: Fix OpenPIC model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt Apple uses an IBM MPIC2A without timers, it has 64 sources. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- hw/intc/openpic.c | 35 +++++++++++++++++++++++++++++++++++ hw/ppc/mac_newworld.c | 2 +- include/hw/ppc/openpic.h | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index 9dd285b923..10d6e871fb 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -92,6 +92,16 @@ static int get_current_cpu(void); #define RAVEN_MAX_TMR OPENPIC_MAX_TMR #define RAVEN_MAX_IPI OPENPIC_MAX_IPI =20 +/* KeyLargo */ +#define KEYLARGO_MAX_CPU 4 +#define KEYLARGO_MAX_EXT 64 +#define KEYLARGO_MAX_IPI 4 +#define KEYLARGO_MAX_IRQ (64 + KEYLARGO_MAX_IPI) +#define KEYLARGO_MAX_TMR 0 +#define KEYLARGO_IPI_IRQ (KEYLARGO_MAX_EXT) /* First IPI IRQ */ +/* Timers don't exist but this makes the code happy... */ +#define KEYLARGO_TMR_IRQ (KEYLARGO_IPI_IRQ + KEYLARGO_MAX_IPI) + /* Interrupt definitions */ #define RAVEN_FE_IRQ (RAVEN_MAX_EXT) /* Internal functional IRQ */ #define RAVEN_ERR_IRQ (RAVEN_MAX_EXT + 1) /* Error IRQ */ @@ -120,6 +130,7 @@ static FslMpicInfo fsl_mpic_42 =3D { #define VID_REVISION_1_3 3 =20 #define VIR_GENERIC 0x00000000 /* Generic Vendor ID */ +#define VIR_MPIC2A 0x00004614 /* IBM MPIC-2A */ =20 #define GCR_RESET 0x80000000 #define GCR_MODE_PASS 0x00000000 @@ -329,6 +340,8 @@ typedef struct OpenPICState { uint32_t nb_cpus; /* Timer registers */ OpenPICTimer timers[OPENPIC_MAX_TMR]; + uint32_t max_tmr; + /* Shared MSI registers */ OpenPICMSI msi[MAX_MSI]; uint32_t max_irq; @@ -1717,6 +1730,28 @@ static void openpic_realize(DeviceState *dev, Error = **errp) =20 map_list(opp, list_le, &list_count); break; + + case OPENPIC_MODEL_KEYLARGO: + opp->nb_irqs =3D KEYLARGO_MAX_EXT; + opp->vid =3D VID_REVISION_1_2; + opp->vir =3D VIR_GENERIC; + opp->vector_mask =3D 0xFF; + opp->tfrr_reset =3D 4160000; + opp->ivpr_reset =3D IVPR_MASK_MASK | IVPR_MODE_MASK; + opp->idr_reset =3D 0; + opp->max_irq =3D KEYLARGO_MAX_IRQ; + opp->irq_ipi0 =3D KEYLARGO_IPI_IRQ; + opp->irq_tim0 =3D KEYLARGO_TMR_IRQ; + opp->brr1 =3D -1; + opp->mpic_mode_mask =3D GCR_MODE_MIXED; + + if (opp->nb_cpus !=3D 1) { + error_setg(errp, "Only UP supported today"); + return; + } + + map_list(opp, list_le, &list_count); + break; } =20 for (i =3D 0; i < opp->nb_cpus; i++) { diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 6a2bce181a..6d0ace20ca 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -342,7 +342,7 @@ static void ppc_core99_init(MachineState *machine) pic =3D g_new0(qemu_irq, 64); =20 dev =3D qdev_create(NULL, TYPE_OPENPIC); - qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); + qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_KEYLARGO); qdev_init_nofail(dev); s =3D SYS_BUS_DEVICE(dev); pic_mem =3D s->mmio[0].memory; diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h index 6137e2d7a2..e55ce546aa 100644 --- a/include/hw/ppc/openpic.h +++ b/include/hw/ppc/openpic.h @@ -20,6 +20,7 @@ enum { #define OPENPIC_MODEL_RAVEN 0 #define OPENPIC_MODEL_FSL_MPIC_20 1 #define OPENPIC_MODEL_FSL_MPIC_42 2 +#define OPENPIC_MODEL_KEYLARGO 3 =20 #define OPENPIC_MAX_SRC 256 #define OPENPIC_MAX_TMR 4 --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498934630743.8942905406442; Wed, 27 Sep 2017 00:55:34 -0700 (PDT) Received: from localhost ([::1]:53062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7Bt-0003PK-RY for importer@patchew.org; Wed, 27 Sep 2017 03:55:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70P-0001TO-2T for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70N-00046I-Jc for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from ozlabs.org ([103.22.144.67]:50449) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70N-00043l-4S; Wed, 27 Sep 2017 03:43:39 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vP0K04z9tXb; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498209; bh=wZIVayHJ8Scu/hU7qfzS4158Oa4RFtJlbc/L2fPifTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/96iafv2INjXQ2KUS+NPSqkctPSTOCkgoH3uf4PbXa1Dl03oUUSEXmIK6zDbBsYu IutRxfgWjQUEjje8/+GRv2SLinQ6WGWOJTwoYL7YbklIMBz/Ru81Oba41+mUHp1q5r w/PRK7pmDJoQzRBTLQMGB9pRU75taetw/lTEzxsQ= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:02 +1000 Message-Id: <20170927074316.4454-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 12/26] ppc/kvm: change kvmppc_get_htab_fd() to return -errno on error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz When kvmppc_get_htab_fd() fails, its return value is propagated up to qemu_savevm_state_iterate() or to qemu_savevm_state_complete_precopy(). All savevm handlers expect to receive a negative errno on error. Let's patch kvmppc_get_htab_fd() accordingly. While here, let's change htab_load() in the spapr code to also propagate the error, since it doesn't make sense to abort() if we couldn't get the htab fd from KVM. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 5 +++-- target/ppc/kvm.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 17ea77618c..ec0ea7b5dd 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1218,7 +1218,7 @@ static int get_htab_fd(sPAPRMachineState *spapr) spapr->htab_fd =3D kvmppc_get_htab_fd(false); if (spapr->htab_fd < 0) { error_report("Unable to open fd for reading hash table from KVM: %= s", - strerror(errno)); + strerror(spapr->htab_fd)); } =20 return spapr->htab_fd; @@ -1958,7 +1958,8 @@ static int htab_load(QEMUFile *f, void *opaque, int v= ersion_id) fd =3D kvmppc_get_htab_fd(true); if (fd < 0) { error_report("Unable to open fd to restore KVM hash table: %s", - strerror(errno)); + strerror(fd)); + return fd; } } =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index be27429b57..2780e692a7 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2556,13 +2556,19 @@ int kvmppc_get_htab_fd(bool write) .flags =3D write ? KVM_GET_HTAB_WRITE : 0, .start_index =3D 0, }; + int ret; =20 if (!cap_htab_fd) { fprintf(stderr, "KVM version doesn't support saving the hash table= \n"); - return -1; + return -ENOTSUP; + } + + ret =3D kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); + if (ret < 0) { + return -errno; } =20 - return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); + return ret; } =20 int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns) --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498910284984.3049412434642; Wed, 27 Sep 2017 00:55:10 -0700 (PDT) Received: from localhost ([::1]:53047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7BL-0002rt-Ea for importer@patchew.org; Wed, 27 Sep 2017 03:54:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70O-0001SZ-5w for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70L-00044D-Pm for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:40 -0400 Received: from ozlabs.org ([103.22.144.67]:44447) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70L-00040X-BU; Wed, 27 Sep 2017 03:43:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vN3vhvz9tXW; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498208; bh=M849/2IFc1zFL5AvRM46fXWBhJaKZ7t9fSCwey+VXjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdDuvZuz9Dxqdr0fkDKTPIKFwnAnoWZgXEsU0reOjq3fK7KYhu1dVfc0ImnRWfBa/ BhlQmGGpDRTj907UzJO6e1dMa8mQ4YNicJTpwBlOINRCVzhPdSmzE0i3gJyVVGXtdh hITnsqx6Lt9DMWV8w8+wOBhIQRGYZO1D0JMixVhM= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:03 +1000 Message-Id: <20170927074316.4454-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 13/26] ppc/kvm: generalize the use of kvmppc_get_htab_fd() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz The use of KVM_PPC_GET_HTAB_FD is open-coded in kvmppc_read_hptes() and kvmppc_write_hpte(). This patch modifies kvmppc_get_htab_fd() so that it can be used everywhere we need to access the in-kernel htab: - add an index argument =3D> only kvmppc_read_hptes() passes an actual index, all other users pass 0 - add an errp argument to propagate error messages to the caller. =3D> spapr migration code prints the error =3D> hpte helpers pass &error_abort to keep the current behavior of hw_error() While here, this also fixes a bug in kvmppc_write_hpte() so that it opens the htab fd for writing instead of reading as it currently does. This never broke anything because we currently never call this code, as explained in the changelog of commit c1385933804bb: "This support updating htab managed by the hypervisor. Currently we don't have any user for this feature. This actually bring the store_hpte interface in-line with the load_hpte one. We may want to use this when we want to emulate henter hcall in qemu for HV kvm." The above is still true today. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 15 +++++++-------- target/ppc/kvm.c | 27 +++++++++------------------ target/ppc/kvm_ppc.h | 4 ++-- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ec0ea7b5dd..90a94952c3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1211,14 +1211,15 @@ static uint64_t spapr_get_patbe(PPCVirtualHyperviso= r *vhyp) */ static int get_htab_fd(sPAPRMachineState *spapr) { + Error *local_err =3D NULL; + if (spapr->htab_fd >=3D 0) { return spapr->htab_fd; } =20 - spapr->htab_fd =3D kvmppc_get_htab_fd(false); + spapr->htab_fd =3D kvmppc_get_htab_fd(false, 0, &local_err); if (spapr->htab_fd < 0) { - error_report("Unable to open fd for reading hash table from KVM: %= s", - strerror(spapr->htab_fd)); + error_report_err(local_err); } =20 return spapr->htab_fd; @@ -1927,6 +1928,7 @@ static int htab_load(QEMUFile *f, void *opaque, int v= ersion_id) sPAPRMachineState *spapr =3D opaque; uint32_t section_hdr; int fd =3D -1; + Error *local_err =3D NULL; =20 if (version_id < 1 || version_id > 1) { error_report("htab_load() bad version"); @@ -1941,8 +1943,6 @@ static int htab_load(QEMUFile *f, void *opaque, int v= ersion_id) } =20 if (section_hdr) { - Error *local_err =3D NULL; - /* First section gives the htab size */ spapr_reallocate_hpt(spapr, section_hdr, &local_err); if (local_err) { @@ -1955,10 +1955,9 @@ static int htab_load(QEMUFile *f, void *opaque, int = version_id) if (!spapr->htab) { assert(kvm_enabled()); =20 - fd =3D kvmppc_get_htab_fd(true); + fd =3D kvmppc_get_htab_fd(true, 0, &local_err); if (fd < 0) { - error_report("Unable to open fd to restore KVM hash table: %s", - strerror(fd)); + error_report_err(local_err); return fd; } } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2780e692a7..5b281b2f1b 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2550,21 +2550,25 @@ int kvmppc_define_rtas_kernel_token(uint32_t token,= const char *function) return kvm_vm_ioctl(kvm_state, KVM_PPC_RTAS_DEFINE_TOKEN, &args); } =20 -int kvmppc_get_htab_fd(bool write) +int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp) { struct kvm_get_htab_fd s =3D { .flags =3D write ? KVM_GET_HTAB_WRITE : 0, - .start_index =3D 0, + .start_index =3D index, }; int ret; =20 if (!cap_htab_fd) { - fprintf(stderr, "KVM version doesn't support saving the hash table= \n"); + error_setg(errp, "KVM version doesn't support %s the HPT", + write ? "writing" : "reading"); return -ENOTSUP; } =20 ret =3D kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s); if (ret < 0) { + error_setg(errp, "Unable to open fd for %s HPT %s KVM: %s", + write ? "writing" : "reading", write ? "to" : "from", + strerror(errno)); return -errno; } =20 @@ -2648,17 +2652,10 @@ void kvm_arch_init_irq_routing(KVMState *s) =20 void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, hwaddr ptex, int n) { - struct kvm_get_htab_fd ghf =3D { - .flags =3D 0, - .start_index =3D ptex, - }; int fd, rc; int i; =20 - fd =3D kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf); - if (fd < 0) { - hw_error("kvmppc_read_hptes: Unable to open HPT fd"); - } + fd =3D kvmppc_get_htab_fd(false, ptex, &error_abort); =20 i =3D 0; while (i < n) { @@ -2700,19 +2697,13 @@ void kvmppc_read_hptes(ppc_hash_pte64_t *hptes, hwa= ddr ptex, int n) void kvmppc_write_hpte(hwaddr ptex, uint64_t pte0, uint64_t pte1) { int fd, rc; - struct kvm_get_htab_fd ghf; struct { struct kvm_get_htab_header hdr; uint64_t pte0; uint64_t pte1; } buf; =20 - ghf.flags =3D 0; - ghf.start_index =3D 0; /* Ignored */ - fd =3D kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &ghf); - if (fd < 0) { - hw_error("kvmppc_write_hpte: Unable to open HPT fd"); - } + fd =3D kvmppc_get_htab_fd(true, 0 /* Ignored */, &error_abort); =20 buf.hdr.n_valid =3D 1; buf.hdr.n_invalid =3D 0; diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 08aab46c5a..349f892631 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -51,7 +51,7 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned = int hash_shift); #endif /* !CONFIG_USER_ONLY */ bool kvmppc_has_cap_epr(void); int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function); -int kvmppc_get_htab_fd(bool write); +int kvmppc_get_htab_fd(bool write, uint64_t index, Error **errp); int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns); int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index, uint16_t n_valid, uint16_t n_invalid); @@ -245,7 +245,7 @@ static inline int kvmppc_define_rtas_kernel_token(uint3= 2_t token, return -1; } =20 -static inline int kvmppc_get_htab_fd(bool write) +static inline int kvmppc_get_htab_fd(bool write, uint64_t index, Error **e= rrp) { return -1; } --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499203483606.0810638455565; Wed, 27 Sep 2017 01:00:03 -0700 (PDT) Received: from localhost ([::1]:53107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7G7-0006sV-8g for importer@patchew.org; Wed, 27 Sep 2017 03:59:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70P-0001Tx-G5 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70O-000477-BF for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70N-00044V-Sw; Wed, 27 Sep 2017 03:43:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vP3pHkz9tXp; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498209; bh=YTmUffPhcybIINddkD5VnbNUmu8ektzggDO4uVoA+oc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJslrn5hFabZZtzY8NFwTjK6wV5pBxZP6xiUjxY27DWQbI0e0Hq4wxNTTGXRvfZZL bowqK2V/B/WZQE+ASSmL4SMxvpecanGV0XjCAhAs4n0QCzVO350VjUGq89i3gI8yPa 47P6wG4ZVUgLPZNZ2mLZyCVahN0uprmRpU45fxAE= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:04 +1000 Message-Id: <20170927074316.4454-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 14/26] spapr: introduce helpers to migrate HPT chunks and the end marker X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz This consolidates some duplicated code in a dedicated helpers. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 90a94952c3..0ce3ec87ac 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1709,6 +1709,23 @@ static int htab_save_setup(QEMUFile *f, void *opaque) return 0; } =20 +static void htab_save_chunk(QEMUFile *f, sPAPRMachineState *spapr, + int chunkstart, int n_valid, int n_invalid) +{ + qemu_put_be32(f, chunkstart); + qemu_put_be16(f, n_valid); + qemu_put_be16(f, n_invalid); + qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), + HASH_PTE_SIZE_64 * n_valid); +} + +static void htab_save_end_marker(QEMUFile *f) +{ + qemu_put_be32(f, 0); + qemu_put_be16(f, 0); + qemu_put_be16(f, 0); +} + static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { @@ -1740,11 +1757,7 @@ static void htab_save_first_pass(QEMUFile *f, sPAPRM= achineState *spapr, if (index > chunkstart) { int n_valid =3D index - chunkstart; =20 - qemu_put_be32(f, chunkstart); - qemu_put_be16(f, n_valid); - qemu_put_be16(f, 0); - qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), - HASH_PTE_SIZE_64 * n_valid); + htab_save_chunk(f, spapr, chunkstart, n_valid, 0); =20 if (has_timeout && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max= _ns) { @@ -1806,11 +1819,7 @@ static int htab_save_later_pass(QEMUFile *f, sPAPRMa= chineState *spapr, int n_valid =3D invalidstart - chunkstart; int n_invalid =3D index - invalidstart; =20 - qemu_put_be32(f, chunkstart); - qemu_put_be16(f, n_valid); - qemu_put_be16(f, n_invalid); - qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), - HASH_PTE_SIZE_64 * n_valid); + htab_save_chunk(f, spapr, chunkstart, n_valid, n_invalid); sent +=3D index - chunkstart; =20 if (!final && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - startt= ime) > max_ns) { @@ -1873,10 +1882,7 @@ static int htab_save_iterate(QEMUFile *f, void *opaq= ue) rc =3D htab_save_later_pass(f, spapr, MAX_ITERATION_NS); } =20 - /* End marker */ - qemu_put_be32(f, 0); - qemu_put_be16(f, 0); - qemu_put_be16(f, 0); + htab_save_end_marker(f); =20 return rc; } @@ -1916,9 +1922,7 @@ static int htab_save_complete(QEMUFile *f, void *opaq= ue) } =20 /* End marker */ - qemu_put_be32(f, 0); - qemu_put_be16(f, 0); - qemu_put_be16(f, 0); + htab_save_end_marker(f); =20 return 0; } --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498972553822.8135375955974; Wed, 27 Sep 2017 00:56:12 -0700 (PDT) Received: from localhost ([::1]:53072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7CV-00040N-QE for importer@patchew.org; Wed, 27 Sep 2017 03:56:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70P-0001TK-2V for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70N-00046S-Sj for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from ozlabs.org ([103.22.144.67]:49611) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70N-00044O-FP; Wed, 27 Sep 2017 03:43:39 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vP1whVz9tXf; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498209; bh=XNAB8P5Qi4lRb+IfLIj9Z+5B29yRmOlbSRwkiPSxZMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WP//q08MzlbyAfkcOHo8t3gVNqqS6/pVBCNfZzZCdlVydfiL9JYJyWv8EIdQj7o7f BR99HJSgmhAHY2Oivnu53FjlTc6Y6yERagIWuptzlAMuWOqTRqM/48+RtpxG/OVj0K 30emd0xGAAj0KD3mxahGOQtjW9+Q5WkeqGn0Cuhg= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:05 +1000 Message-Id: <20170927074316.4454-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 15/26] ppc/pnv: Improve macro parenthesization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Eric Blake Although none of the existing macro call-sites were broken, it's always better to write macros that properly parenthesize arguments that can be complex expressions, so that the intended order of operations is not broken. Signed-off-by: Eric Blake Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- include/hw/ppc/pnv_xscom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h index 3757b2cab9..38077b4796 100644 --- a/include/hw/ppc/pnv_xscom.h +++ b/include/hw/ppc/pnv_xscom.h @@ -54,7 +54,7 @@ typedef struct PnvXScomInterfaceClass { * PCB SLAVE 0x110Fxxxx */ =20 -#define PNV_XSCOM_EX_CORE_BASE(base, i) (base | (((uint64_t)i) << 24)) +#define PNV_XSCOM_EX_CORE_BASE(base, i) ((base) | ((uint64_t)(i) << 24)) #define PNV_XSCOM_EX_CORE_SIZE 0x100000 =20 #define PNV_XSCOM_LPC_BASE 0xb0020 --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499390426587.1957807094695; Wed, 27 Sep 2017 01:03:10 -0700 (PDT) Received: from localhost ([::1]:53130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7J7-0000gs-Lz for importer@patchew.org; Wed, 27 Sep 2017 04:03:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70R-0001Vi-0c for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70O-00047z-S4 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:43 -0400 Received: from ozlabs.org ([103.22.144.67]:35001) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70O-00044Z-Fz; Wed, 27 Sep 2017 03:43:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vQ1y67z9tY0; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498210; bh=VmG53OwpTYOQbEqBC9Az4nGJLgsdklxfH7ymC1jYVh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IMtm2+PL7J4ORgTP7+AaUuiggi2/s6GlmeEVMOg6IXLqS9KwS7muurrsC+cMkVM0q AoZ/r+eIMNOen8qePQusAm+uYgTgu1D/ybqKFMeelWP0LN+xQalkWqO3m0EBE+MmSO jBMP6k53cexBmK/x0MZO/psNt/gCgEFw/kyLNV3Q= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:06 +1000 Message-Id: <20170927074316.4454-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 16/26] macio: convert pmac_ide_ops from old_mmio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ide/macio.c | 181 ++++++++++++++++++++++++-----------------------------= ---- 1 file changed, 75 insertions(+), 106 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index db5db390e7..18ae952934 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -255,131 +255,100 @@ static void pmac_ide_flush(DBDMA_io *io) } =20 /* PowerMac IDE memory IO */ -static void pmac_ide_writeb (void *opaque, - hwaddr addr, uint32_t val) +static uint64_t pmac_ide_read(void *opaque, hwaddr addr, unsigned size) { MACIOIDEState *d =3D opaque; - - addr =3D (addr & 0xFFF) >> 4; - switch (addr) { - case 1 ... 7: - ide_ioport_write(&d->bus, addr, val); - break; - case 8: - case 22: - ide_cmd_write(&d->bus, 0, val); + uint64_t retval =3D 0xffffffff; + int reg =3D addr >> 4; + + switch (reg) { + case 0x0: + if (size =3D=3D 2) { + retval =3D ide_data_readw(&d->bus, 0); + } else if (size =3D=3D 4) { + retval =3D ide_data_readl(&d->bus, 0); + } break; - default: + case 0x1 ... 0x7: + if (size =3D=3D 1) { + retval =3D ide_ioport_read(&d->bus, reg); + } break; - } -} - -static uint32_t pmac_ide_readb (void *opaque,hwaddr addr) -{ - uint8_t retval; - MACIOIDEState *d =3D opaque; - - addr =3D (addr & 0xFFF) >> 4; - switch (addr) { - case 1 ... 7: - retval =3D ide_ioport_read(&d->bus, addr); + case 0x8: + case 0x16: + if (size =3D=3D 1) { + retval =3D ide_status_read(&d->bus, 0); + } break; - case 8: - case 22: - retval =3D ide_status_read(&d->bus, 0); + case 0x20: + if (size =3D=3D 4) { + retval =3D d->timing_reg; + } break; - default: - retval =3D 0xFF; + case 0x30: + /* This is an interrupt state register that only exists + * in the KeyLargo and later variants. Bit 0x8000_0000 + * latches the DMA interrupt and has to be written to + * clear. Bit 0x4000_0000 is an image of the disk + * interrupt. MacOS X relies on this and will hang if + * we don't provide at least the disk interrupt + */ + if (size =3D=3D 4) { + retval =3D d->irq_reg; + } break; } - return retval; -} =20 -static void pmac_ide_writew (void *opaque, - hwaddr addr, uint32_t val) -{ - MACIOIDEState *d =3D opaque; - - addr =3D (addr & 0xFFF) >> 4; - val =3D bswap16(val); - if (addr =3D=3D 0) { - ide_data_writew(&d->bus, 0, val); - } -} - -static uint32_t pmac_ide_readw (void *opaque,hwaddr addr) -{ - uint16_t retval; - MACIOIDEState *d =3D opaque; - - addr =3D (addr & 0xFFF) >> 4; - if (addr =3D=3D 0) { - retval =3D ide_data_readw(&d->bus, 0); - } else { - retval =3D 0xFFFF; - } - retval =3D bswap16(retval); return retval; } =20 -static void pmac_ide_writel (void *opaque, - hwaddr addr, uint32_t val) -{ - MACIOIDEState *d =3D opaque; =20 - addr =3D (addr & 0xFFF) >> 4; - val =3D bswap32(val); - if (addr =3D=3D 0) { - ide_data_writel(&d->bus, 0, val); - } else if (addr =3D=3D 0x20) { - d->timing_reg =3D val; - } else if (addr =3D=3D 0x30) { - if (val & 0x80000000u) { - d->irq_reg &=3D 0x7fffffff; - } - } -} - -static uint32_t pmac_ide_readl (void *opaque,hwaddr addr) +static void pmac_ide_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) { - uint32_t retval; MACIOIDEState *d =3D opaque; - - addr =3D (addr & 0xFFF) >> 4; - if (addr =3D=3D 0) { - retval =3D ide_data_readl(&d->bus, 0); - } else if (addr =3D=3D 0x20) { - retval =3D d->timing_reg; - } else if (addr =3D=3D 0x30) { - /* This is an interrupt state register that only exists - * in the KeyLargo and later variants. Bit 0x8000_0000 - * latches the DMA interrupt and has to be written to - * clear. Bit 0x4000_0000 is an image of the disk - * interrupt. MacOS X relies on this and will hang if - * we don't provide at least the disk interrupt - */ - retval =3D d->irq_reg; - } else { - retval =3D 0xFFFFFFFF; + int reg =3D addr >> 4; + + switch (reg) { + case 0x0: + if (size =3D=3D 2) { + ide_data_writew(&d->bus, 0, val); + } else if (size =3D=3D 4) { + ide_data_writel(&d->bus, 0, val); + } + break; + case 0x1 ... 0x7: + if (size =3D=3D 1) { + ide_ioport_write(&d->bus, reg, val); + } + break; + case 0x8: + case 0x16: + if (size =3D=3D 1) { + ide_cmd_write(&d->bus, 0, val); + } + break; + case 0x20: + if (size =3D=3D 4) { + d->timing_reg =3D val; + } + break; + case 0x30: + if (size =3D=3D 4) { + if (val & 0x80000000u) { + d->irq_reg &=3D 0x7fffffff; + } + } + break; } - retval =3D bswap32(retval); - return retval; } =20 static const MemoryRegionOps pmac_ide_ops =3D { - .old_mmio =3D { - .write =3D { - pmac_ide_writeb, - pmac_ide_writew, - pmac_ide_writel, - }, - .read =3D { - pmac_ide_readb, - pmac_ide_readw, - pmac_ide_readl, - }, - }, - .endianness =3D DEVICE_NATIVE_ENDIAN, + .read =3D pmac_ide_read, + .write =3D pmac_ide_write, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 4, + .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 static const VMStateDescription vmstate_pmac =3D { --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498508731677.883020661916; Wed, 27 Sep 2017 00:48:28 -0700 (PDT) Received: from localhost ([::1]:53008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx74n-0005Gg-CL for importer@patchew.org; Wed, 27 Sep 2017 03:48:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70Q-0001Un-9J for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70O-00047Q-Ig for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:42 -0400 Received: from ozlabs.org ([103.22.144.67]:52117) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70O-00044f-2T; Wed, 27 Sep 2017 03:43:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vR2GSVz9tXy; Wed, 27 Sep 2017 17:43:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498211; bh=jbALzekLXhQgrEOGFl8HL0p3wRcTRw9sKTLaxfMAdik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U9fSKkWyJwPBO2FTShvxgiWzmcloCInpGH0h4pvKBgCMcRAexFsdQssjPutW9vI2f 6k58CEKzlNNM0CMDbMERlE5Q+XZX+sYZyVEzUjUzaomEuGE156W7ByUruyPoF22SAo a5kbsc6CUxZoQnuJuFsFzEOl2/D7zVCySMx6vd2g= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:07 +1000 Message-Id: <20170927074316.4454-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 17/26] spapr_pci: make index property mandatory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz PHBs can be created with an index property, in which case the machine code automatically sets all the MMIO windows at addresses derived from the index. Alternatively, they can be manually created without index, but the user has to provide addresses for all MMIO windows. The non-index way happens to be more trouble than it's worth: it's difficult to use, keeps requiring (potentially incompatible) changes when some new parameter needs adding, and is awkward to check for collisions. It currently even has a bug that prevents to use two non-index PHBs because their child DRCs are all derived from the same index =3D=3D -1 value, and, thus, collide. This patch hence makes the index property mandatory. As a consequence, the PHB's memory regions and BUID are now always configured according to the index, and it is no longer possible to set them from the command line. This DOES BREAK backwards compat, but we don't think the non-index PHB feature was used in practice (at least libvirt doesn't) and the simplification is worth it. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 62 +++++++-------------------------------------------= ---- 1 file changed, 8 insertions(+), 54 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index cf54160526..6126c80044 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1523,16 +1523,6 @@ static void spapr_phb_realize(DeviceState *dev, Erro= r **errp) sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); Error *local_err =3D NULL; =20 - if ((sphb->buid !=3D (uint64_t)-1) || (sphb->dma_liobn[0] !=3D (ui= nt32_t)-1) - || (sphb->dma_liobn[1] !=3D (uint32_t)-1 && windows_supported = =3D=3D 2) - || (sphb->mem_win_addr !=3D (hwaddr)-1) - || (sphb->mem64_win_addr !=3D (hwaddr)-1) - || (sphb->io_win_addr !=3D (hwaddr)-1)) { - error_setg(errp, "Either \"index\" or other parameters must" - " be specified for PAPR PHB, not both"); - return; - } - smc->phb_placement(spapr, sphb->index, &sphb->buid, &sphb->io_win_addr, &sphb->mem_win_addr, &sphb->mem64_win_addr, @@ -1541,46 +1531,20 @@ static void spapr_phb_realize(DeviceState *dev, Err= or **errp) error_propagate(errp, local_err); return; } - } - - if (sphb->buid =3D=3D (uint64_t)-1) { - error_setg(errp, "BUID not specified for PHB"); - return; - } - - if ((sphb->dma_liobn[0] =3D=3D (uint32_t)-1) || - ((sphb->dma_liobn[1] =3D=3D (uint32_t)-1) && (windows_supported > = 1))) { - error_setg(errp, "LIOBN(s) not specified for PHB"); - return; - } - - if (sphb->mem_win_addr =3D=3D (hwaddr)-1) { - error_setg(errp, "Memory window address not specified for PHB"); - return; - } - - if (sphb->io_win_addr =3D=3D (hwaddr)-1) { - error_setg(errp, "IO window address not specified for PHB"); + } else { + error_setg(errp, "\"index\" for PAPR PHB is mandatory"); return; } =20 if (sphb->mem64_win_size !=3D 0) { - if (sphb->mem64_win_addr =3D=3D (hwaddr)-1) { - error_setg(errp, - "64-bit memory window address not specified for PHB= "); - return; - } - if (sphb->mem_win_size > SPAPR_PCI_MEM32_WIN_SIZE) { error_setg(errp, "32-bit memory window of size 0x%"HWADDR_PRIx " (max 2 GiB)", sphb->mem_win_size); return; } =20 - if (sphb->mem64_win_pciaddr =3D=3D (hwaddr)-1) { - /* 64-bit window defaults to identity mapping */ - sphb->mem64_win_pciaddr =3D sphb->mem64_win_addr; - } + /* 64-bit window defaults to identity mapping */ + sphb->mem64_win_pciaddr =3D sphb->mem64_win_addr; } else if (sphb->mem_win_size > SPAPR_PCI_MEM32_WIN_SIZE) { /* * For compatibility with old configuration, if no 64-bit MMIO @@ -1622,18 +1586,16 @@ static void spapr_phb_realize(DeviceState *dev, Err= or **errp) memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr, &sphb->mem32window); =20 - if (sphb->mem64_win_pciaddr !=3D (hwaddr)-1) { + if (sphb->mem64_win_size !=3D 0) { namebuf =3D g_strdup_printf("%s.mmio64-alias", sphb->dtbusname); memory_region_init_alias(&sphb->mem64window, OBJECT(sphb), namebuf, &sphb->memspace, sphb->mem64_win_pciaddr, sphb->mem64_win_= size); g_free(namebuf); =20 - if (sphb->mem64_win_addr !=3D (hwaddr)-1) { - memory_region_add_subregion(get_system_memory(), - sphb->mem64_win_addr, - &sphb->mem64window); - } + memory_region_add_subregion(get_system_memory(), + sphb->mem64_win_addr, + &sphb->mem64window); } =20 /* Initialize IO regions */ @@ -1789,18 +1751,10 @@ static void spapr_phb_reset(DeviceState *qdev) =20 static Property spapr_phb_properties[] =3D { DEFINE_PROP_UINT32("index", sPAPRPHBState, index, -1), - DEFINE_PROP_UINT64("buid", sPAPRPHBState, buid, -1), - DEFINE_PROP_UINT32("liobn", sPAPRPHBState, dma_liobn[0], -1), - DEFINE_PROP_UINT32("liobn64", sPAPRPHBState, dma_liobn[1], -1), - DEFINE_PROP_UINT64("mem_win_addr", sPAPRPHBState, mem_win_addr, -1), DEFINE_PROP_UINT64("mem_win_size", sPAPRPHBState, mem_win_size, SPAPR_PCI_MEM32_WIN_SIZE), - DEFINE_PROP_UINT64("mem64_win_addr", sPAPRPHBState, mem64_win_addr, -1= ), DEFINE_PROP_UINT64("mem64_win_size", sPAPRPHBState, mem64_win_size, SPAPR_PCI_MEM64_WIN_SIZE), - DEFINE_PROP_UINT64("mem64_win_pciaddr", sPAPRPHBState, mem64_win_pciad= dr, - -1), - DEFINE_PROP_UINT64("io_win_addr", sPAPRPHBState, io_win_addr, -1), DEFINE_PROP_UINT64("io_win_size", sPAPRPHBState, io_win_size, SPAPR_PCI_IO_WIN_SIZE), DEFINE_PROP_BOOL("dynamic-reconfiguration", sPAPRPHBState, dr_enabled, --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498724463415.0285756799037; Wed, 27 Sep 2017 00:52:04 -0700 (PDT) Received: from localhost ([::1]:53031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx78T-00006a-Op for importer@patchew.org; Wed, 27 Sep 2017 03:52:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70P-0001UO-TC for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70O-00047W-JH for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:41 -0400 Received: from ozlabs.org ([103.22.144.67]:38149) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70O-00044d-4e; Wed, 27 Sep 2017 03:43:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vQ6pfdz9tXs; Wed, 27 Sep 2017 17:43:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498210; bh=JaFLjAqv/gM47IPXyx4fVNwkmrYRHPEkJHWTr8Uolrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCQPBT7M4evFUp9ZTlNwgOZ0QUVu49v5ADJwzeKsTz+6ss0FnOLQyt9GLzqQkkTUr K0wWD9alvn58wWq26q2yy6XpzwydPVmwp1e6NzjNHFCzbdCGRuusmjYQVnAlogscFG jNDuu2E8SXswNgbYNMQ1vRBV9nQB+l5yDYjkFpns= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:08 +1000 Message-Id: <20170927074316.4454-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 18/26] ppc: remove unused CPU definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: John Snow Following commit aef77960, remove now-unused definitions from cpu-models.h. Signed-off-by: John Snow Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/cpu-models.h | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index ed64005ff8..152365425d 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -292,34 +292,6 @@ enum { #endif CPU_POWERPC_e200z5 =3D 0x81000000, CPU_POWERPC_e200z6 =3D 0x81120000, - /* MPC55xx microcontrollers */ -#define CPU_POWERPC_MPC55xx CPU_POWERPC_MPC5567 -#if 0 -#define CPU_POWERPC_MPC5514E CPU_POWERPC_MPC5514E_v1 -#define CPU_POWERPC_MPC5514E_v0 CPU_POWERPC_e200z0 -#define CPU_POWERPC_MPC5514E_v1 CPU_POWERPC_e200z1 -#define CPU_POWERPC_MPC5514G CPU_POWERPC_MPC5514G_v1 -#define CPU_POWERPC_MPC5514G_v0 CPU_POWERPC_e200z0 -#define CPU_POWERPC_MPC5514G_v1 CPU_POWERPC_e200z1 -#define CPU_POWERPC_MPC5515S CPU_POWERPC_e200z1 -#define CPU_POWERPC_MPC5516E CPU_POWERPC_MPC5516E_v1 -#define CPU_POWERPC_MPC5516E_v0 CPU_POWERPC_e200z0 -#define CPU_POWERPC_MPC5516E_v1 CPU_POWERPC_e200z1 -#define CPU_POWERPC_MPC5516G CPU_POWERPC_MPC5516G_v1 -#define CPU_POWERPC_MPC5516G_v0 CPU_POWERPC_e200z0 -#define CPU_POWERPC_MPC5516G_v1 CPU_POWERPC_e200z1 -#define CPU_POWERPC_MPC5516S CPU_POWERPC_e200z1 -#endif -#if 0 -#define CPU_POWERPC_MPC5533 CPU_POWERPC_e200z3 -#define CPU_POWERPC_MPC5534 CPU_POWERPC_e200z3 -#endif -#define CPU_POWERPC_MPC5553 CPU_POWERPC_e200z6 -#define CPU_POWERPC_MPC5554 CPU_POWERPC_e200z6 -#define CPU_POWERPC_MPC5561 CPU_POWERPC_e200z6 -#define CPU_POWERPC_MPC5565 CPU_POWERPC_e200z6 -#define CPU_POWERPC_MPC5566 CPU_POWERPC_e200z6 -#define CPU_POWERPC_MPC5567 CPU_POWERPC_e200z6 /* e300 family */ /* e300 cores */ CPU_POWERPC_e300c1 =3D 0x00830010, @@ -327,11 +299,7 @@ enum { CPU_POWERPC_e300c3 =3D 0x00850010, CPU_POWERPC_e300c4 =3D 0x00860010, /* MPC83xx microcontrollers */ -#define CPU_POWERPC_MPC831x CPU_POWERPC_e300c3 -#define CPU_POWERPC_MPC832x CPU_POWERPC_e300c2 #define CPU_POWERPC_MPC834x CPU_POWERPC_e300c1 -#define CPU_POWERPC_MPC835x CPU_POWERPC_e300c1 -#define CPU_POWERPC_MPC836x CPU_POWERPC_e300c1 #define CPU_POWERPC_MPC837x CPU_POWERPC_e300c4 /* e500 family */ /* e500 cores */ --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499261521679.948575905587; Wed, 27 Sep 2017 01:01:01 -0700 (PDT) Received: from localhost ([::1]:53115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7Gx-0007aQ-Ok for importer@patchew.org; Wed, 27 Sep 2017 04:00:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70U-0001a5-5R for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70Q-0004AC-Si for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:58451) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70P-00044Y-6S; Wed, 27 Sep 2017 03:43:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vP5k6Tz9tXn; Wed, 27 Sep 2017 17:43:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498209; bh=gUoqDTvOS/chXej+35bdW2UltoL94be3I6l67dvkJvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MzoerS/VB1AgscQxj5F1GSFzGpJo+OnYiGQjslhHaIMGkkXzIy0l1Qc+LBOL2bwHS fe9gNt2w/vIHB7W3nzQRZKTum8ESJ6M5VouJsPrBsrNLr2Le72wIEQoE4zuQqmZvqI B32YkkhIDzzdGT1YwEczJrsR1/n0afxcGDD7jqfk= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:09 +1000 Message-Id: <20170927074316.4454-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 19/26] ppc: remove all unused CPU definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: John Snow Remove *all* unused CPU definitions as indicated by compile-time `#if 0` constructs. Signed-off-by: John Snow [dwg: Removed some additional now-useless comments] Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/cpu-models.h | 225 --------------------------------------------= ---- 1 file changed, 225 deletions(-) diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index 152365425d..25ef372d4c 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -44,184 +44,55 @@ enum { /* PowerPC 401 cores */ CPU_POWERPC_401A1 =3D 0x00210000, CPU_POWERPC_401B2 =3D 0x00220000, -#if 0 - CPU_POWERPC_401B3 =3D xxx, -#endif CPU_POWERPC_401C2 =3D 0x00230000, CPU_POWERPC_401D2 =3D 0x00240000, CPU_POWERPC_401E2 =3D 0x00250000, CPU_POWERPC_401F2 =3D 0x00260000, CPU_POWERPC_401G2 =3D 0x00270000, /* PowerPC 401 microcontrolers */ -#if 0 - CPU_POWERPC_401GF =3D xxx, -#endif #define CPU_POWERPC_IOP480 CPU_POWERPC_401B2 /* IBM Processor for Network Resources */ CPU_POWERPC_COBRA =3D 0x10100000, /* XXX: 405 ? */ -#if 0 - CPU_POWERPC_XIPCHIP =3D xxx, -#endif /* PowerPC 403 family */ /* PowerPC 403 microcontrollers */ CPU_POWERPC_403GA =3D 0x00200011, CPU_POWERPC_403GB =3D 0x00200100, CPU_POWERPC_403GC =3D 0x00200200, CPU_POWERPC_403GCX =3D 0x00201400, -#if 0 - CPU_POWERPC_403GP =3D xxx, -#endif /* PowerPC 405 family */ /* PowerPC 405 cores */ -#if 0 - CPU_POWERPC_405A3 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405A4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405B3 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405B4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405C3 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405C4 =3D xxx, -#endif CPU_POWERPC_405D2 =3D 0x20010000, -#if 0 - CPU_POWERPC_405D3 =3D xxx, -#endif CPU_POWERPC_405D4 =3D 0x41810000, -#if 0 - CPU_POWERPC_405D5 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405E4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405F4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405F5 =3D xxx, -#endif -#if 0 - CPU_POWERPC_405F6 =3D xxx, -#endif /* PowerPC 405 microcontrolers */ /* XXX: missing 0x200108a0 */ CPU_POWERPC_405CRa =3D 0x40110041, CPU_POWERPC_405CRb =3D 0x401100C5, CPU_POWERPC_405CRc =3D 0x40110145, CPU_POWERPC_405EP =3D 0x51210950, -#if 0 - CPU_POWERPC_405EXr =3D xxx, -#endif CPU_POWERPC_405EZ =3D 0x41511460, /* 0x51210950 ? */ -#if 0 - CPU_POWERPC_405FX =3D xxx, -#endif CPU_POWERPC_405GPa =3D 0x40110000, CPU_POWERPC_405GPb =3D 0x40110040, CPU_POWERPC_405GPc =3D 0x40110082, CPU_POWERPC_405GPd =3D 0x401100C4, CPU_POWERPC_405GPR =3D 0x50910951, -#if 0 - CPU_POWERPC_405H =3D xxx, -#endif -#if 0 - CPU_POWERPC_405L =3D xxx, -#endif CPU_POWERPC_405LP =3D 0x41F10000, -#if 0 - CPU_POWERPC_405PM =3D xxx, -#endif -#if 0 - CPU_POWERPC_405PS =3D xxx, -#endif -#if 0 - CPU_POWERPC_405S =3D xxx, -#endif /* IBM network processors */ CPU_POWERPC_NPE405H =3D 0x414100C0, CPU_POWERPC_NPE405H2 =3D 0x41410140, CPU_POWERPC_NPE405L =3D 0x416100C0, CPU_POWERPC_NPE4GS3 =3D 0x40B10000, -#if 0 - CPU_POWERPC_NPCxx1 =3D xxx, -#endif -#if 0 - CPU_POWERPC_NPR161 =3D xxx, -#endif -#if 0 - CPU_POWERPC_LC77700 =3D xxx, -#endif /* IBM STBxxx (PowerPC 401/403/405 core based microcontrollers) */ -#if 0 - CPU_POWERPC_STB01000 =3D xxx, -#endif -#if 0 - CPU_POWERPC_STB01010 =3D xxx, -#endif -#if 0 - CPU_POWERPC_STB0210 =3D xxx, /* 401B3 */ -#endif CPU_POWERPC_STB03 =3D 0x40310000, /* 0x40130000 ? */ -#if 0 - CPU_POWERPC_STB043 =3D xxx, -#endif -#if 0 - CPU_POWERPC_STB045 =3D xxx, -#endif CPU_POWERPC_STB04 =3D 0x41810000, CPU_POWERPC_STB25 =3D 0x51510950, -#if 0 - CPU_POWERPC_STB130 =3D xxx, -#endif /* Xilinx cores */ CPU_POWERPC_X2VP4 =3D 0x20010820, CPU_POWERPC_X2VP20 =3D 0x20010860, -#if 0 - CPU_POWERPC_ZL10310 =3D xxx, -#endif -#if 0 - CPU_POWERPC_ZL10311 =3D xxx, -#endif -#if 0 - CPU_POWERPC_ZL10320 =3D xxx, -#endif -#if 0 - CPU_POWERPC_ZL10321 =3D xxx, -#endif /* PowerPC 440 family */ /* Generic PowerPC 440 */ #define CPU_POWERPC_440 CPU_POWERPC_440GXf /* PowerPC 440 cores */ -#if 0 - CPU_POWERPC_440A4 =3D xxx, -#endif CPU_POWERPC_440_XILINX =3D 0x7ff21910, -#if 0 - CPU_POWERPC_440A5 =3D xxx, -#endif -#if 0 - CPU_POWERPC_440B4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_440F5 =3D xxx, -#endif -#if 0 - CPU_POWERPC_440G5 =3D xxx, -#endif -#if 0 - CPU_POWERPC_440H4 =3D xxx, -#endif -#if 0 - CPU_POWERPC_440H6 =3D xxx, -#endif /* PowerPC 440 microcontrolers */ CPU_POWERPC_440EPa =3D 0x42221850, CPU_POWERPC_440EPb =3D 0x422218D3, @@ -234,25 +105,10 @@ enum { CPU_POWERPC_440GXb =3D 0x51B21851, CPU_POWERPC_440GXc =3D 0x51B21892, CPU_POWERPC_440GXf =3D 0x51B21894, -#if 0 - CPU_POWERPC_440S =3D xxx, -#endif CPU_POWERPC_440SP =3D 0x53221850, CPU_POWERPC_440SP2 =3D 0x53221891, CPU_POWERPC_440SPE =3D 0x53421890, CPU_POWERPC_460EXb =3D 0x130218A4, /* called 460 but 440 c= ore */ - /* PowerPC 460 family */ -#if 0 - /* Generic PowerPC 464 */ -#define CPU_POWERPC_464 CPU_POWERPC_464H90 -#endif - /* PowerPC 464 microcontrolers */ -#if 0 - CPU_POWERPC_464H90 =3D xxx, -#endif -#if 0 - CPU_POWERPC_464H90FP =3D xxx, -#endif /* Freescale embedded PowerPC cores */ /* PowerPC MPC 5xx cores (aka RCPU) */ CPU_POWERPC_MPC5xx =3D 0x00020020, @@ -281,15 +137,6 @@ enum { #define CPU_POWERPC_MPC5200B_v21 CPU_POWERPC_G2LEgp1 /* e200 family */ /* e200 cores */ -#if 0 - CPU_POWERPC_e200z0 =3D xxx, -#endif -#if 0 - CPU_POWERPC_e200z1 =3D xxx, -#endif -#if 0 /* ? */ - CPU_POWERPC_e200z3 =3D 0x81120000, -#endif CPU_POWERPC_e200z5 =3D 0x81000000, CPU_POWERPC_e200z6 =3D 0x81120000, /* e300 family */ @@ -407,9 +254,6 @@ enum { /* XXX: missing 0x000a0100 */ /* XXX: missing 0x00093102 */ CPU_POWERPC_604R =3D 0x000a0101, -#if 0 - CPU_POWERPC_604EV =3D xxx, /* XXX: same as 604R ? */ -#endif /* PowerPC 740/750 cores (aka G3) */ /* XXX: missing 0x00084202 */ CPU_POWERPC_7x0_v10 =3D 0x00080100, @@ -464,9 +308,6 @@ enum { CPU_POWERPC_7x5_v26 =3D 0x00083206, CPU_POWERPC_7x5_v27 =3D 0x00083207, CPU_POWERPC_7x5_v28 =3D 0x00083208, -#if 0 - CPU_POWERPC_7x5P =3D xxx, -#endif /* PowerPC 74xx cores (aka G4) */ /* XXX: missing 0x000C1101 */ CPU_POWERPC_7400_v10 =3D 0x000C0100, @@ -554,12 +395,6 @@ enum { /* XXX: should be POWER (RIOS), RSC3308, RSC4608, * POWER2 (RIOS2) & RSC2 (P2SC) here */ -#if 0 - CPU_POWER =3D xxx, /* 0x20000 ? 0x30000 for RSC ?= */ -#endif -#if 0 - CPU_POWER2 =3D xxx, /* 0x40000 ? */ -#endif /* PA Semi core */ CPU_POWERPC_PA6T =3D 0x00900000, }; @@ -583,60 +418,6 @@ enum { POWERPC_SVR_5200B_v20 =3D 0x80110020, POWERPC_SVR_5200B_v21 =3D 0x80110021, #define POWERPC_SVR_55xx POWERPC_SVR_5567 -#if 0 - POWERPC_SVR_5533 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5534 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5553 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5554 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5561 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5565 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5566 =3D xxx, -#endif -#if 0 - POWERPC_SVR_5567 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8313 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8313E =3D xxx, -#endif -#if 0 - POWERPC_SVR_8314 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8314E =3D xxx, -#endif -#if 0 - POWERPC_SVR_8315 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8315E =3D xxx, -#endif -#if 0 - POWERPC_SVR_8321 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8321E =3D xxx, -#endif -#if 0 - POWERPC_SVR_8323 =3D xxx, -#endif -#if 0 - POWERPC_SVR_8323E =3D xxx, -#endif POWERPC_SVR_8343 =3D 0x80570010, POWERPC_SVR_8343A =3D 0x80570030, POWERPC_SVR_8343E =3D 0x80560010, @@ -653,12 +434,6 @@ enum { POWERPC_SVR_8349A =3D 0x80510030, POWERPC_SVR_8349E =3D 0x80500010, POWERPC_SVR_8349EA =3D 0x80500030, -#if 0 - POWERPC_SVR_8358E =3D xxx, -#endif -#if 0 - POWERPC_SVR_8360E =3D xxx, -#endif #define POWERPC_SVR_E500 0x40000000 POWERPC_SVR_8377 =3D 0x80C70010 | POWERPC_SVR_E500, POWERPC_SVR_8377E =3D 0x80C60010 | POWERPC_SVR_E500, --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499436407786.8744952406424; Wed, 27 Sep 2017 01:03:56 -0700 (PDT) Received: from localhost ([::1]:53131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7Ju-0001Bq-Gt for importer@patchew.org; Wed, 27 Sep 2017 04:03:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70U-0001aA-6N for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70Q-0004A6-PP for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:56305) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70Q-00047f-CX; Wed, 27 Sep 2017 03:43:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vS4MDXz9tY5; Wed, 27 Sep 2017 17:43:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498212; bh=jU1EdgRglMTVrC13yBIyXMwju3DtEgG2TV48i4q2jqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQyy/vu3/dT7oOgR9MCo6XYZ84m+036dfxFpCHqjlmysFEAgiFlQbXdWSaDEppR4A fnmUFDC82yJwLMDJAeMbkXGHnWsS5B9KBzdIz/ScM1IP5wD0nG6i9T4RGvq6dJScWR VlZaEGzsA0vxKd03wC0yjIOKZYBaSUOMsz7YfShE= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:10 +1000 Message-Id: <20170927074316.4454-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 20/26] ppc/pnv: check for OPAL firmware file presence X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater and exit before uselessly trying to load it if the file does not exists. Issue discovered by Coverity Scan. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/pnv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 47221158d4..d46d91c76f 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -570,10 +570,14 @@ static void ppc_powernv_init(MachineState *machine) } =20 fw_filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (!fw_filename) { + error_report("Could not find OPAL firmware '%s'", bios_name); + exit(1); + } =20 fw_size =3D load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE= ); if (fw_size < 0) { - error_report("Could not load OPAL '%s'", fw_filename); + error_report("Could not load OPAL firmware '%s'", fw_filename); exit(1); } g_free(fw_filename); --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498669200840.8007034041503; Wed, 27 Sep 2017 00:51:09 -0700 (PDT) Received: from localhost ([::1]:53027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx77W-0007bc-De for importer@patchew.org; Wed, 27 Sep 2017 03:51:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70U-0001b0-R9 for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70R-0004At-AC for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:44047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70Q-000489-IC; Wed, 27 Sep 2017 03:43:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vT0D4tz9tY2; Wed, 27 Sep 2017 17:43:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498213; bh=jWyWEH9DOcu4ldYwgiasO0I51FGysI2YCaeSL/GryHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X234bnhUuMTpDuCeFdIgiqkzps9lkbkKWIgjpNg3xDEns66yCy4Etj4QjfqGyCq0/ GwALXRYeNrf8nnHCoE8wU15X7TljviTO6MfL+IxOmghzsboOs4Wz7ppNQ+A6RYJi9D eVgqfHc2PYm9g7A6MICIoHQB7yLy4HxF6aluaDqY= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:11 +1000 Message-Id: <20170927074316.4454-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 21/26] spapr: fix the value of SDR1 in kvmppc_put_books_sregs() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz When running with KVM PR, if a new HPT is allocated we need to inform KVM about the HPT address and size. This is currently done by hacking the value of SDR1 and pushing it to KVM in several places. Also, migration breaks the guest since it is very unlikely the HPT has the same address in source and destination, but we push the incoming value of SDR1 to KVM anyway. This patch introduces a new virtual hypervisor hook so that the spapr code can provide the correct value of SDR1 to be pushed to KVM each time kvmppc_put_books_sregs() is called. It allows to get rid of all the hacking in the spapr/kvmppc code and it fixes migration of nested KVM PR. Suggested-by: David Gibson Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 14 ++++++++++++++ hw/ppc/spapr_cpu_core.c | 16 +--------------- hw/ppc/spapr_hcall.c | 45 +++++++++++++++++++++++++++++++++------------ target/ppc/cpu.h | 1 + target/ppc/kvm.c | 32 +++++++------------------------- target/ppc/kvm_ppc.h | 6 ------ 6 files changed, 56 insertions(+), 58 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0ce3ec87ac..ff87f155d5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1240,6 +1240,19 @@ static hwaddr spapr_hpt_mask(PPCVirtualHypervisor *v= hyp) return HTAB_SIZE(spapr) / HASH_PTEG_SIZE_64 - 1; } =20 +static target_ulong spapr_encode_hpt_for_kvm_pr(PPCVirtualHypervisor *vhyp) +{ + sPAPRMachineState *spapr =3D SPAPR_MACHINE(vhyp); + + assert(kvm_enabled()); + + if (!spapr->htab) { + return 0; + } + + return (target_ulong)(uintptr_t)spapr->htab | (spapr->htab_shift - 18); +} + static const ppc_hash_pte64_t *spapr_map_hptes(PPCVirtualHypervisor *vhyp, hwaddr ptex, int n) { @@ -3604,6 +3617,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) vhc->unmap_hptes =3D spapr_unmap_hptes; vhc->store_hpte =3D spapr_store_hpte; vhc->get_patbe =3D spapr_get_patbe; + vhc->encode_hpt_for_kvm_pr =3D spapr_encode_hpt_for_kvm_pr; xic->ics_get =3D spapr_ics_get; xic->ics_resend =3D spapr_ics_resend; xic->icp_get =3D spapr_icp_get; diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index c08ee7571a..3e20b1d886 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -18,6 +18,7 @@ #include "hw/ppc/ppc.h" #include "target/ppc/mmu-hash64.h" #include "sysemu/numa.h" +#include "sysemu/hw_accel.h" #include "qemu/error-report.h" =20 void spapr_cpu_parse_features(sPAPRMachineState *spapr) @@ -73,7 +74,6 @@ void spapr_cpu_parse_features(sPAPRMachineState *spapr) =20 static void spapr_cpu_reset(void *opaque) { - sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); PowerPCCPU *cpu =3D opaque; CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; @@ -86,20 +86,6 @@ static void spapr_cpu_reset(void *opaque) cs->halted =3D 1; =20 env->spr[SPR_HIOR] =3D 0; - - /* - * This is a hack for the benefit of KVM PR - it abuses the SDR1 - * slot in kvm_sregs to communicate the userspace address of the - * HPT - */ - if (kvm_enabled()) { - env->spr[SPR_SDR1] =3D (target_ulong)(uintptr_t)spapr->htab - | (spapr->htab_shift - 18); - if (kvmppc_put_books_sregs(cpu) < 0) { - error_report("Unable to update SDR1 in KVM"); - exit(1); - } - } } =20 static void spapr_cpu_destroy(PowerPCCPU *cpu) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 57bb411394..8d72bb7c1c 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -686,6 +686,37 @@ static int rehash_hpt(PowerPCCPU *cpu, return H_SUCCESS; } =20 +static void do_push_sregs_to_kvm_pr(CPUState *cs, run_on_cpu_data data) +{ + int ret; + + cpu_synchronize_state(cs); + + ret =3D kvmppc_put_books_sregs(POWERPC_CPU(cs)); + if (ret < 0) { + error_report("failed to push sregs to KVM: %s", strerror(-ret)); + exit(1); + } +} + +static void push_sregs_to_kvm_pr(sPAPRMachineState *spapr) +{ + CPUState *cs; + + /* + * This is a hack for the benefit of KVM PR - it abuses the SDR1 + * slot in kvm_sregs to communicate the userspace address of the + * HPT + */ + if (!kvm_enabled() || !spapr->htab) { + return; + } + + CPU_FOREACH(cs) { + run_on_cpu(cs, do_push_sregs_to_kvm_pr, RUN_ON_CPU_NULL); + } +} + static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, @@ -733,12 +764,7 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cp= u, spapr->htab =3D pending->hpt; spapr->htab_shift =3D pending->shift; =20 - if (kvm_enabled()) { - /* For KVM PR, update the HPT pointer */ - target_ulong sdr1 =3D (target_ulong)(uintptr_t)spapr->htab - | (spapr->htab_shift - 18); - kvmppc_update_sdr1(sdr1); - } + push_sregs_to_kvm_pr(spapr); =20 pending->hpt =3D NULL; /* so it's not free()d */ } @@ -1564,12 +1590,7 @@ static target_ulong h_client_architecture_support(Po= werPCCPU *cpu, * the point this is called, nothing should have been * entered into the existing HPT */ spapr_reallocate_hpt(spapr, maxshift, &error_fatal); - if (kvm_enabled()) { - /* For KVM PR, update the HPT pointer */ - target_ulong sdr1 =3D (target_ulong)(uintptr_t)spapr->htab - | (spapr->htab_shift - 18); - kvmppc_update_sdr1(sdr1); - } + push_sregs_to_kvm_pr(spapr); } } =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index c9d3ffa89b..64aef17f6f 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1243,6 +1243,7 @@ struct PPCVirtualHypervisorClass { void (*store_hpte)(PPCVirtualHypervisor *vhyp, hwaddr ptex, uint64_t pte0, uint64_t pte1); uint64_t (*get_patbe)(PPCVirtualHypervisor *vhyp); + target_ulong (*encode_hpt_for_kvm_pr)(PPCVirtualHypervisor *vhyp); }; =20 #define TYPE_PPC_VIRTUAL_HYPERVISOR "ppc-virtual-hypervisor" diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 5b281b2f1b..171d3d8040 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -941,7 +941,13 @@ int kvmppc_put_books_sregs(PowerPCCPU *cpu) =20 sregs.pvr =3D env->spr[SPR_PVR]; =20 - sregs.u.s.sdr1 =3D env->spr[SPR_SDR1]; + if (cpu->vhyp) { + PPCVirtualHypervisorClass *vhc =3D + PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); + sregs.u.s.sdr1 =3D vhc->encode_hpt_for_kvm_pr(cpu->vhyp); + } else { + sregs.u.s.sdr1 =3D env->spr[SPR_SDR1]; + } =20 /* Sync SLB */ #ifdef TARGET_PPC64 @@ -2798,30 +2804,6 @@ int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target= _ulong flags, int shift) return kvm_vm_ioctl(cs->kvm_state, KVM_PPC_RESIZE_HPT_COMMIT, &rhpt); } =20 -static void kvmppc_pivot_hpt_cpu(CPUState *cs, run_on_cpu_data arg) -{ - target_ulong sdr1 =3D arg.target_ptr; - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - CPUPPCState *env =3D &cpu->env; - - /* This is just for the benefit of PR KVM */ - cpu_synchronize_state(cs); - env->spr[SPR_SDR1] =3D sdr1; - if (kvmppc_put_books_sregs(cpu) < 0) { - error_report("Unable to update SDR1 in KVM"); - exit(1); - } -} - -void kvmppc_update_sdr1(target_ulong sdr1) -{ - CPUState *cs; - - CPU_FOREACH(cs) { - run_on_cpu(cs, kvmppc_pivot_hpt_cpu, RUN_ON_CPU_TARGET_PTR(sdr1)); - } -} - /* * This is a helper function to detect a post migration scenario * in which a guest, running as KVM-HV, freezes in cpu_post_load because diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 349f892631..d6be38ecaf 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -67,7 +67,6 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); void kvmppc_check_papr_resize_hpt(Error **errp); int kvmppc_resize_hpt_prepare(PowerPCCPU *cpu, target_ulong flags, int shi= ft); int kvmppc_resize_hpt_commit(PowerPCCPU *cpu, target_ulong flags, int shif= t); -void kvmppc_update_sdr1(target_ulong sdr1); bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu); =20 bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path); @@ -325,11 +324,6 @@ static inline int kvmppc_resize_hpt_commit(PowerPCCPU = *cpu, return -ENOSYS; } =20 -static inline void kvmppc_update_sdr1(target_ulong sdr1) -{ - abort(); -} - #endif =20 #ifndef CONFIG_KVM --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499668977614.2708618684142; Wed, 27 Sep 2017 01:07:48 -0700 (PDT) Received: from localhost ([::1]:53172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7Ng-0004gp-AW for importer@patchew.org; Wed, 27 Sep 2017 04:07:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70U-0001ac-FS for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70S-0004CT-VC for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:48223) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70S-00048A-9Y; Wed, 27 Sep 2017 03:43:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vT1Trcz9tY3; Wed, 27 Sep 2017 17:43:30 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498213; bh=62TEiotjW+2oY1z7l1vowKbTmtGYmOCaCNr3N775MBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gY2fsVp0eMql5dDglQBWbsE6xSehAyW6lUF84mHj7NT3JI4ZRLINyrgX0DfcbCNvX MJLI9BSkY6uwHzE/UAdVZVgAfoOOfK5DZBQV1ap+SyDlOn/1lNdhl78BClSnsgMAE+ tgkbHMRDXfFLU+P49atigB4CugFIPNEaEHoboQOs= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:12 +1000 Message-Id: <20170927074316.4454-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 22/26] mac_dbdma: remove unused IO fields from DBDMAState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland These fields were used to manually handle IO requests that weren't aligned to a sector boundary before this feature was supported by the block API. Once the block API changed to support byte-aligned IO requests, the macio controller was switched over to use it in commit be1e343 but these fields were accidentally left behind. Remove them, including the initialisation in DBDMA_init(). Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/mac_dbdma.c | 2 -- include/hw/ppc/mac_dbdma.h | 4 ---- 2 files changed, 6 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 3fe507393f..979517263f 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -893,9 +893,7 @@ void* DBDMA_init (MemoryRegion **dbdma_mem) s =3D g_malloc0(sizeof(DBDMAState)); =20 for (i =3D 0; i < DBDMA_CHANNELS; i++) { - DBDMA_io *io =3D &s->channels[i].io; DBDMA_channel *ch =3D &s->channels[i]; - qemu_iovec_init(&io->iov, 1); =20 ch->rw =3D dbdma_unassigned_rw; ch->flush =3D dbdma_unassigned_flush; diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index a8603877d7..21bd66f3c9 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -42,10 +42,6 @@ struct DBDMA_io { DBDMA_end dma_end; /* DMA is in progress, don't start another one */ bool processing; - /* unaligned last sector of a request */ - uint8_t head_remainder[0x200]; - uint8_t tail_remainder[0x200]; - QEMUIOVector iov; /* DMA request */ void *dma_mem; dma_addr_t dma_len; --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499157033429.05191026599834; Wed, 27 Sep 2017 00:59:17 -0700 (PDT) Received: from localhost ([::1]:53104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7FN-0006LD-94 for importer@patchew.org; Wed, 27 Sep 2017 03:59:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70U-0001a6-5k for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70R-0004BM-LM for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:44973) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70R-000470-0L; Wed, 27 Sep 2017 03:43:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vS1Rcnz9tY7; Wed, 27 Sep 2017 17:43:30 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498212; bh=1aUXrg0uL2uZzsFHrguorLczp+3YSQmsIv4Vs53jyC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUGetN0Vw9nsiD32/Xau8IoOQjilODyDObexOQCxdghaptqZqrs5Lmygla3Rzto2u XJoB7AfAv91DnlD///0RkAAJbXAyHycE6ntlJl6SLMYWRe5q053AOYDDvfkeEi4JO/ 1/+w2PKzC5mm+L7mwbtxnTtLie42W5xPDO+OsaVg= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:13 +1000 Message-Id: <20170927074316.4454-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 23/26] mac_dbdma: QOMify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/mac_dbdma.c | 59 ++++++++++++++++++++++++++++++++++++++----= ---- include/hw/ppc/mac_dbdma.h | 6 +++++ 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 979517263f..302f131c0e 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -851,13 +851,14 @@ static const VMStateDescription vmstate_dbdma =3D { } }; =20 -static void dbdma_reset(void *opaque) +static void mac_dbdma_reset(DeviceState *d) { - DBDMAState *s =3D opaque; + DBDMAState *s =3D MAC_DBDMA(d); int i; =20 - for (i =3D 0; i < DBDMA_CHANNELS; i++) + for (i =3D 0; i < DBDMA_CHANNELS; i++) { memset(s->channels[i].regs, 0, DBDMA_SIZE); + } } =20 static void dbdma_unassigned_rw(DBDMA_io *io) @@ -888,9 +889,22 @@ static void dbdma_unassigned_flush(DBDMA_io *io) void* DBDMA_init (MemoryRegion **dbdma_mem) { DBDMAState *s; - int i; + SysBusDevice *sbd; + + s =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); + object_property_set_bool(OBJECT(s), true, "realized", NULL); + + sbd =3D SYS_BUS_DEVICE(s); + *dbdma_mem =3D sysbus_mmio_get_region(sbd, 0); =20 - s =3D g_malloc0(sizeof(DBDMAState)); + return s; +} + +static void mac_dbdma_init(Object *obj) +{ + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + DBDMAState *s =3D MAC_DBDMA(obj); + int i; =20 for (i =3D 0; i < DBDMA_CHANNELS; i++) { DBDMA_channel *ch =3D &s->channels[i]; @@ -901,12 +915,37 @@ void* DBDMA_init (MemoryRegion **dbdma_mem) ch->io.channel =3D ch; } =20 - memory_region_init_io(&s->mem, NULL, &dbdma_ops, s, "dbdma", 0x1000); - *dbdma_mem =3D &s->mem; - vmstate_register(NULL, -1, &vmstate_dbdma, s); - qemu_register_reset(dbdma_reset, s); + memory_region_init_io(&s->mem, obj, &dbdma_ops, s, "dbdma", 0x1000); + sysbus_init_mmio(sbd, &s->mem); +} + +static void mac_dbdma_realize(DeviceState *dev, Error **errp) +{ + DBDMAState *s =3D MAC_DBDMA(dev); =20 s->bh =3D qemu_bh_new(DBDMA_run_bh, s); +} =20 - return s; +static void mac_dbdma_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->realize =3D mac_dbdma_realize; + dc->reset =3D mac_dbdma_reset; + dc->vmsd =3D &vmstate_dbdma; } + +static const TypeInfo mac_dbdma_type_info =3D { + .name =3D TYPE_MAC_DBDMA, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(DBDMAState), + .instance_init =3D mac_dbdma_init, + .class_init =3D mac_dbdma_class_init +}; + +static void mac_dbdma_register_types(void) +{ + type_register_static(&mac_dbdma_type_info); +} + +type_init(mac_dbdma_register_types) diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 21bd66f3c9..4bc6274656 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -26,6 +26,7 @@ #include "exec/memory.h" #include "qemu/iov.h" #include "sysemu/dma.h" +#include "hw/sysbus.h" =20 typedef struct DBDMA_io DBDMA_io; =20 @@ -160,6 +161,8 @@ typedef struct DBDMA_channel { } DBDMA_channel; =20 typedef struct { + SysBusDevice parent_obj; + MemoryRegion mem; DBDMA_channel channels[DBDMA_CHANNELS]; QEMUBH *bh; @@ -173,4 +176,7 @@ void DBDMA_register_channel(void *dbdma, int nchan, qem= u_irq irq, void DBDMA_kick(DBDMAState *dbdma); void* DBDMA_init (MemoryRegion **dbdma_mem); =20 +#define TYPE_MAC_DBDMA "mac-dbdma" +#define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) + #endif --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150649956079652.012547764467854; Wed, 27 Sep 2017 01:06:00 -0700 (PDT) Received: from localhost ([::1]:53160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7M0-0002zZ-30 for importer@patchew.org; Wed, 27 Sep 2017 04:06:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70W-0001cq-Ad for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70U-0004DZ-4R for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:48 -0400 Received: from ozlabs.org ([103.22.144.67]:42767) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70T-0004AN-5C; Wed, 27 Sep 2017 03:43:45 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vR4WrYz9tXw; Wed, 27 Sep 2017 17:43:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498211; bh=61oFXpiHYiBLrPNx2ywwazsJBgpW5r+raYWxm/JHy2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFqujqhvddICCcWyZPVd6a0Qm6ig8GSyeozmnK/vsapq3ddYLy5CAcbVxDAIUWovE TcTzJUwJ8Kf4OOZcdodEuA9oOiZCUmX9I3EuGtuwl00kKkPw0yMO1db8/sopMmFM6s 9X3I7VNYxNIGWBiIWAL+VE02gmiu/0XN0FvlI5do= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:14 +1000 Message-Id: <20170927074316.4454-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 24/26] mac_dbdma: remove DBDMA_init() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Instead we can now instantiate the MAC_DBDMA object directly within the macio device. We also add the DBDMA device as a child property so that it is possible to retrieve later. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/mac_dbdma.c | 14 -------------- hw/misc/macio/macio.c | 16 ++++++++++++---- include/hw/ppc/mac_dbdma.h | 1 - 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index 302f131c0e..0eddf2e700 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -886,20 +886,6 @@ static void dbdma_unassigned_flush(DBDMA_io *io) __func__, ch->channel); } =20 -void* DBDMA_init (MemoryRegion **dbdma_mem) -{ - DBDMAState *s; - SysBusDevice *sbd; - - s =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); - object_property_set_bool(OBJECT(s), true, "realized", NULL); - - sbd =3D SYS_BUS_DEVICE(s); - *dbdma_mem =3D sysbus_mmio_get_region(sbd, 0); - - return s; -} - static void mac_dbdma_init(Object *obj) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 5d57f45dc6..f459f17f2f 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -41,7 +41,7 @@ typedef struct MacIOState =20 MemoryRegion bar; CUDAState cuda; - void *dbdma; + DBDMAState *dbdma; MemoryRegion *pic_mem; MemoryRegion *escc_mem; uint64_t frequency; @@ -127,10 +127,15 @@ static void macio_common_realize(PCIDevice *d, Error = **errp) MacIOState *s =3D MACIO(d); SysBusDevice *sysbus_dev; Error *err =3D NULL; - MemoryRegion *dbdma_mem; =20 - s->dbdma =3D DBDMA_init(&dbdma_mem); - memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem); + object_property_set_bool(OBJECT(s->dbdma), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + sysbus_dev =3D SYS_BUS_DEVICE(s->dbdma); + memory_region_add_subregion(&s->bar, 0x08000, + sysbus_mmio_get_region(sysbus_dev, 0)); =20 object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err); if (err) { @@ -334,6 +339,9 @@ static void macio_instance_init(Object *obj) object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA); qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default()); object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL); + + s->dbdma =3D MAC_DBDMA(object_new(TYPE_MAC_DBDMA)); + object_property_add_child(obj, "dbdma", OBJECT(s->dbdma), NULL); } =20 static const VMStateDescription vmstate_macio_oldworld =3D { diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 4bc6274656..26cc469de4 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -174,7 +174,6 @@ void DBDMA_register_channel(void *dbdma, int nchan, qem= u_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque); void DBDMA_kick(DBDMAState *dbdma); -void* DBDMA_init (MemoryRegion **dbdma_mem); =20 #define TYPE_MAC_DBDMA "mac-dbdma" #define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506499322867993.2512462830713; Wed, 27 Sep 2017 01:02:02 -0700 (PDT) Received: from localhost ([::1]:53121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7Hx-0008IM-Vi for importer@patchew.org; Wed, 27 Sep 2017 04:01:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70R-0001Wg-UF for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70Q-00049L-2G for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:43 -0400 Received: from ozlabs.org ([103.22.144.67]:34713) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70P-00046f-MA; Wed, 27 Sep 2017 03:43:41 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vR6qL4z9tY6; Wed, 27 Sep 2017 17:43:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498211; bh=gJqErY3F9ELupYM9/Db9B0WqOhIZdOQCh65g+/1oXHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GTg8MKJnzDrbGEiNC3xf0kP4Qdon78ugfPpJP323txjHhwG+1vvLEntxJT/12mSNv kbYpwUyqTjcrkN0KPP8qe2EWXEYOmhTVMeJMiQNwYwggNVaVUEueG0ylyAzit8h+a5 BeP6mxDeTh1CDxRbmIqHhr5twAuq00C5UgZorbbE= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:15 +1000 Message-Id: <20170927074316.4454-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 25/26] macio: pass channel into MACIOIDEState via qdev property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland One of the reasons macio_ide_register_dma() needs to exist is because the channel id isn't passed into the MACIO_IDE object. Pass in the channel id using a qdev property to remove this requirement. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ide/macio.c | 10 ++++++++-- hw/misc/macio/macio.c | 4 +++- hw/ppc/mac.h | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 18ae952934..19d5f5a8b3 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -452,12 +452,18 @@ static void macio_ide_initfn(Object *obj) s->ide_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 1); } =20 +static Property macio_ide_properties[] =3D { + DEFINE_PROP_UINT32("channel", MACIOIDEState, channel, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void macio_ide_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D macio_ide_realizefn; dc->reset =3D macio_ide_reset; + dc->props =3D macio_ide_properties; dc->vmsd =3D &vmstate_pmac; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -487,10 +493,10 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInf= o **hd_table) } } =20 -void macio_ide_register_dma(MACIOIDEState *s, void *dbdma, int channel) +void macio_ide_register_dma(MACIOIDEState *s, void *dbdma) { s->dbdma =3D dbdma; - DBDMA_register_channel(dbdma, channel, s->dma_irq, + DBDMA_register_channel(dbdma, s->channel, s->dma_irq, pmac_ide_transfer, pmac_ide_flush, s); } =20 diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index f459f17f2f..41b377e7a0 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -159,7 +159,9 @@ static void macio_realize_ide(MacIOState *s, MACIOIDESt= ate *ide, sysbus_dev =3D SYS_BUS_DEVICE(ide); sysbus_connect_irq(sysbus_dev, 0, irq0); sysbus_connect_irq(sysbus_dev, 1, irq1); - macio_ide_register_dma(ide, s->dbdma, dmaid); + qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid); + macio_ide_register_dma(ide, s->dbdma); + object_property_set_bool(OBJECT(ide), true, "realized", errp); } =20 diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 300fc8ab68..b3a26c49c1 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -131,7 +131,7 @@ typedef struct MACIOIDEState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ - + uint32_t channel; qemu_irq real_ide_irq; qemu_irq real_dma_irq; qemu_irq ide_irq; @@ -147,7 +147,7 @@ typedef struct MACIOIDEState { } MACIOIDEState; =20 void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); -void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma, int channel); +void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma); =20 void macio_init(PCIDevice *dev, MemoryRegion *pic_mem, --=20 2.13.5 From nobody Thu May 2 11:21:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506498850327468.6197305290739; Wed, 27 Sep 2017 00:54:10 -0700 (PDT) Received: from localhost ([::1]:53043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx7AF-0001qO-EZ for importer@patchew.org; Wed, 27 Sep 2017 03:53:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dx70a-0001iN-TD for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dx70W-0004GT-SJ for qemu-devel@nongnu.org; Wed, 27 Sep 2017 03:43:52 -0400 Received: from ozlabs.org ([103.22.144.67]:38985) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dx70W-0004Cy-FZ; Wed, 27 Sep 2017 03:43:48 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3y28vT3GYlz9tY4; Wed, 27 Sep 2017 17:43:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1506498213; bh=vvdL94TXb0P2ga1ihMMkT6CTGna3vHsaXnAp+zLao4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GV5cO/w3WQpr27wfOzSCAqCKVko9r8BaeTJdSUBs80FSqqHP7YkncJNtST86tBh2B JUc5SOxp8hQjzDocge6m+B6Qq3dQn0BZTHRmOs/nR1WyvZukOKZsHEvLwy6emqL8yC Jd0gig5GVAHKMtqERr2o3oCQvjq6F5VHEtMtF89M= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 27 Sep 2017 17:43:16 +1000 Message-Id: <20170927074316.4454-27-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170927074316.4454-1-david@gibson.dropbear.id.au> References: <20170927074316.4454-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 26/26] macio: use object link between MACIO_IDE and MAC_DBDMA object X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Using a standard QOM object link we can pass a reference to the MAC_DBDMA controller to the MACIO_IDE object which removes the last external parameter to macio_ide_register_dma(). Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ide/macio.c | 9 ++++++--- hw/misc/macio/macio.c | 3 ++- hw/ppc/mac.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 19d5f5a8b3..ce194c6cec 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -450,6 +450,10 @@ static void macio_ide_initfn(Object *obj) sysbus_init_irq(d, &s->real_dma_irq); s->dma_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 0); s->ide_irq =3D qemu_allocate_irq(pmac_ide_irq, s, 1); + + object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA, + (Object **) &s->dbdma, + qdev_prop_allow_set_link_before_realize, 0, N= ULL); } =20 static Property macio_ide_properties[] =3D { @@ -493,10 +497,9 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo= **hd_table) } } =20 -void macio_ide_register_dma(MACIOIDEState *s, void *dbdma) +void macio_ide_register_dma(MACIOIDEState *s) { - s->dbdma =3D dbdma; - DBDMA_register_channel(dbdma, s->channel, s->dma_irq, + DBDMA_register_channel(s->dbdma, s->channel, s->dma_irq, pmac_ide_transfer, pmac_ide_flush, s); } =20 diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 41b377e7a0..9aa7e7559b 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -160,7 +160,8 @@ static void macio_realize_ide(MacIOState *s, MACIOIDESt= ate *ide, sysbus_connect_irq(sysbus_dev, 0, irq0); sysbus_connect_irq(sysbus_dev, 1, irq1); qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid); - macio_ide_register_dma(ide, s->dbdma); + object_property_set_link(OBJECT(ide), OBJECT(s->dbdma), "dbdma", errp); + macio_ide_register_dma(ide); =20 object_property_set_bool(OBJECT(ide), true, "realized", errp); } diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index b3a26c49c1..b501af1653 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -147,7 +147,7 @@ typedef struct MACIOIDEState { } MACIOIDEState; =20 void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); -void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma); +void macio_ide_register_dma(MACIOIDEState *ide); =20 void macio_init(PCIDevice *dev, MemoryRegion *pic_mem, --=20 2.13.5