From nobody Thu May 2 00:48:53 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.zoho.com; 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 1488329943396270.33802845596574; Tue, 28 Feb 2017 16:59:03 -0800 (PST) Received: from localhost ([::1]:37857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cisbe-0005oD-3t for importer@patchew.org; Tue, 28 Feb 2017 19:59:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cisb7-0005ny-16 for qemu-devel@nongnu.org; Tue, 28 Feb 2017 19:58:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cisb3-00073y-W5 for qemu-devel@nongnu.org; Tue, 28 Feb 2017 19:58:29 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43565 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cisb3-00073i-Po for qemu-devel@nongnu.org; Tue, 28 Feb 2017 19:58:25 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v210tKOq023654 for ; Tue, 28 Feb 2017 19:58:24 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 28wkmch002-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 28 Feb 2017 19:58:24 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 28 Feb 2017 17:58:23 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 28 Feb 2017 17:58:20 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 7E5D619D8041; Tue, 28 Feb 2017 17:57:31 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v210wKLq15401462; Tue, 28 Feb 2017 17:58:20 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2914113603A; Tue, 28 Feb 2017 17:58:20 -0700 (MST) Received: from localhost (unknown [9.53.92.194]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id 0AC0F13603C; Tue, 28 Feb 2017 17:58:20 -0700 (MST) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 28 Feb 2017 18:56:47 -0600 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030100-0028-0000-0000-0000072C06E4 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006700; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000205; SDB=6.00828320; UDB=6.00405963; IPR=6.00605836; BA=6.00005175; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014478; XFM=3.00000011; UTC=2017-03-01 00:58:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030100-0029-0000-0000-000033F89822 Message-Id: <1488329807-11193-1-git-send-email-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-28_21:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=29 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1703010007 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH] spapr_pci: allow control of BAR alignment through SLOF 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: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Nikunj A Dadhania , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In certain cases, such as PCI-passthrough with VFIO, we cannot offload MMIO accesses to KVM unless the BAR alignment matches the host. This patch, in conjunction with a separately submitted patch for SLOF which allows for control of this via the device-tree, allows us to set this alignment via QEMU. Cc: qemu-ppc@nongnu.org Cc: Nikunj A Dadhania Cc: David Gibson Cc: Alexey Kardashevskiy Signed-off-by: Michael Roth --- hw/ppc/spapr.c | 7 ++++++- hw/ppc/spapr_pci.c | 8 ++++++++ include/hw/pci-host/spapr.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 81c6c1c..321951c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3121,7 +3121,12 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", true); * pseries-2.8 */ #define SPAPR_COMPAT_2_8 \ - HW_COMPAT_2_8 + HW_COMPAT_2_8 \ + { \ + .driver =3D TYPE_SPAPR_PCI_HOST_BRIDGE, \ + .property =3D "mem_bar_min_align", \ + .value =3D "0", \ + }, \ =20 static void spapr_machine_2_8_instance_options(MachineState *machine) { diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 2a3499e..fdfd494 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1660,6 +1660,10 @@ static void spapr_phb_realize(DeviceState *dev, Erro= r **errp) return; } =20 + if (sphb->mem_bar_min_align =3D=3D (uint64_t)-1) { + sphb->mem_bar_min_align =3D qemu_real_host_page_size; + } + sphb->dtbusname =3D g_strdup_printf("pci@%" PRIx64, sphb->buid); =20 namebuf =3D alloca(strlen(sphb->dtbusname) + 32); @@ -1854,6 +1858,8 @@ static Property spapr_phb_properties[] =3D { DEFINE_PROP_UINT32("numa_node", sPAPRPHBState, numa_node, -1), DEFINE_PROP_BOOL("pre-2.8-migration", sPAPRPHBState, pre_2_8_migration, false), + DEFINE_PROP_UINT64("mem_bar_min_align", sPAPRPHBState, mem_bar_min_ali= gn, + -1), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -2224,6 +2230,8 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, if (ret) { return ret; } + _FDT(fdt_setprop_cell(fdt, bus_off, "qemu,mem-bar-min-align", + phb->mem_bar_min_align)); =20 return 0; } diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index dfa7614..fa33346 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -79,6 +79,7 @@ struct sPAPRPHBState { uint64_t dma64_win_addr; =20 uint32_t numa_node; + uint64_t mem_bar_min_align; =20 /* Fields for migration compatibility hacks */ bool pre_2_8_migration; --=20 2.7.4