From nobody Sun May 5 22:41:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1603732726; cv=none; d=zohomail.com; s=zohoarc; b=ICjh4r3/Re1Se698q8ww/QwyhW6WgLj/qUoTfg8uh+RkZF5c/HGpAUXnTNWlaAmwvtUZwdeVUW42Q8yqelbGYfX89+JvZF5J7zMjoJSzzgIbcmMPmQf5Mi8iCLRHFw8r0ol/Tg1v6OdpfycdJsUQUumyPJPZKbI3q5iyDr74Dq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603732726; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=XqdVPP5hAdHDyQAocLAFrSiiA0aSl2ncbC08orL80FU=; b=Iu++CKFdDRIxbRKfgkr4LbWvhBuk2c6HWyyGdkGdy+KM2Gr1uWQn/nQiHET94wgKssOaXLASGF3ZYZnnXwXFYNduzfKHfou6MBnYAi1LvXMQKxklsLSfdAhO/i02WNrz90ssVMSL8NveDG13Rqeb78sjuBaXTed/KiEYw2PzGVY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603732726390383.04071650038054; Mon, 26 Oct 2020 10:18:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.12475.32486 (Exim 4.92) (envelope-from ) id 1kX68c-00033C-N3; Mon, 26 Oct 2020 17:18:30 +0000 Received: by outflank-mailman (output) from mailman id 12475.32486; Mon, 26 Oct 2020 17:18:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68c-000334-JJ; Mon, 26 Oct 2020 17:18:30 +0000 Received: by outflank-mailman (input) for mailman id 12475; Mon, 26 Oct 2020 17:18:28 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68a-00032c-Qx for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:28 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 6fd7745e-367b-44aa-beec-076783c922f6; Mon, 26 Oct 2020 17:18:27 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33967139F; Mon, 26 Oct 2020 10:18:27 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 011B33F719; Mon, 26 Oct 2020 10:18:25 -0700 (PDT) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68a-00032c-Qx for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:28 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 6fd7745e-367b-44aa-beec-076783c922f6; Mon, 26 Oct 2020 17:18:27 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33967139F; Mon, 26 Oct 2020 10:18:27 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 011B33F719; Mon, 26 Oct 2020 10:18:25 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6fd7745e-367b-44aa-beec-076783c922f6 From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v1 1/4] xen/ns16550: solve compilation error on ARM with CONFIG_HAS_PCI enabled. Date: Mon, 26 Oct 2020 17:17:51 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" ARM platforms does not support ns16550 PCI support. When CONFIG_HAS_PCI is enabled for ARM a compilation error is observed. Fixed compilation error after introducing new kconfig option CONFIG_HAS_NS16550_PCI for x86 platforms to support ns16550 PCI. No functional change. Signed-off-by: Rahul Singh --- xen/drivers/char/Kconfig | 7 +++++++ xen/drivers/char/ns16550.c | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig index b572305657..8887e86afe 100644 --- a/xen/drivers/char/Kconfig +++ b/xen/drivers/char/Kconfig @@ -4,6 +4,13 @@ config HAS_NS16550 help This selects the 16550-series UART support. For most systems, say Y. =20 +config HAS_NS16550_PCI + bool "NS16550 UART PCI support" if X86 + default y + depends on X86 && HAS_NS16550 && HAS_PCI + help + This selects the 16550-series UART PCI support. For most systems, say Y. + config HAS_CADENCE_UART bool "Xilinx Cadence UART driver" default y diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index d8b52eb813..bd1c2af956 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -16,7 +16,7 @@ #include #include #include -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI #include #include #include @@ -54,7 +54,7 @@ enum serial_param_type { reg_shift, reg_width, stop_bits, -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI bridge_bdf, device, port_bdf, @@ -83,7 +83,7 @@ static struct ns16550 { unsigned int timeout_ms; bool_t intr_works; bool_t dw_usr_bsy; -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI /* PCI card parameters. */ bool_t pb_bdf_enable; /* if =3D1, pb-bdf effective, port behind brid= ge */ bool_t ps_bdf_enable; /* if =3D1, ps_bdf effective, port on pci card= */ @@ -117,14 +117,14 @@ static const struct serial_param_var __initconst sp_v= ars[] =3D { {"reg-shift", reg_shift}, {"reg-width", reg_width}, {"stop-bits", stop_bits}, -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI {"bridge", bridge_bdf}, {"dev", device}, {"port", port_bdf}, #endif }; =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI struct ns16550_config { u16 vendor_id; u16 dev_id; @@ -620,7 +620,7 @@ static int ns16550_getc(struct serial_port *port, char = *pc) =20 static void pci_serial_early_init(struct ns16550 *uart) { -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( !uart->ps_bdf_enable || uart->io_base >=3D 0x10000 ) return; =20 @@ -719,7 +719,7 @@ static void __init ns16550_init_preirq(struct serial_po= rt *port) =20 static void __init ns16550_init_irq(struct serial_port *port) { -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI struct ns16550 *uart =3D port->uart; =20 if ( uart->msi ) @@ -761,7 +761,7 @@ static void __init ns16550_init_postirq(struct serial_p= ort *port) uart->timeout_ms =3D max_t( unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud); =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( uart->bar || uart->ps_bdf_enable ) { if ( uart->param && uart->param->mmio && @@ -841,7 +841,7 @@ static void ns16550_suspend(struct serial_port *port) =20 stop_timer(&uart->timer); =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( uart->bar ) uart->cr =3D pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_= bdf[1], uart->ps_bdf[2]), PCI_COMMAND); @@ -850,7 +850,7 @@ static void ns16550_suspend(struct serial_port *port) =20 static void _ns16550_resume(struct serial_port *port) { -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI struct ns16550 *uart =3D port->uart; =20 if ( uart->bar ) @@ -1013,7 +1013,7 @@ static int __init check_existence(struct ns16550 *uar= t) return 1; /* Everything is MMIO */ #endif =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI pci_serial_early_init(uart); #endif =20 @@ -1044,7 +1044,7 @@ static int __init check_existence(struct ns16550 *uar= t) return (status =3D=3D 0x90); } =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI static int __init pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx) { @@ -1305,7 +1305,7 @@ static bool __init parse_positional(struct ns16550 *u= art, char **str) =20 if ( *conf =3D=3D ',' && *++conf !=3D ',' ) { -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( strncmp(conf, "pci", 3) =3D=3D 0 ) { if ( pci_uart_config(uart, 1/* skip AMT */, uart - ns16550_com= ) ) @@ -1327,7 +1327,7 @@ static bool __init parse_positional(struct ns16550 *u= art, char **str) =20 if ( *conf =3D=3D ',' && *++conf !=3D ',' ) { -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( strncmp(conf, "msi", 3) =3D=3D 0 ) { conf +=3D 3; @@ -1339,7 +1339,7 @@ static bool __init parse_positional(struct ns16550 *u= art, char **str) uart->irq =3D simple_strtol(conf, &conf, 10); } =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI if ( *conf =3D=3D ',' && *++conf !=3D ',' ) { conf =3D parse_pci(conf, NULL, &uart->ps_bdf[0], @@ -1419,7 +1419,7 @@ static bool __init parse_namevalue_pairs(char *str, s= truct ns16550 *uart) uart->reg_width =3D simple_strtoul(param_value, NULL, 0); break; =20 -#ifdef CONFIG_HAS_PCI +#ifdef CONFIG_HAS_NS16550_PCI case bridge_bdf: if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0], &uart->ps_bdf[1], &uart->ps_bdf[2]) ) --=20 2.17.1 From nobody Sun May 5 22:41:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1603732734; cv=none; d=zohomail.com; s=zohoarc; b=a3ig+i5MjVK+iGQaira3PNzt7YBK+pWcLJwQwZGl0/tSeB6egfTBeSapYA4Kum02YtxbyNM3wZWsfvyuvUNWPNKwRuIepXb4baQm0/mgVqOMb6EiyOr4JjYbG9FezOgSnxo5hTcCI+78CmAk9iwRWCFY0y702FKnCqnrXOza8/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603732734; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=pwfUuj5F2SipdyRvo8q99M1LgaDEZX5Su0ceuTssTlU=; b=V5RU4PJ4hac25EGCdYE08V9c5jz9KSyV0NoBN08XYV/kSwIhnfAkQrJsITUj91O+bKFnMrJafEFCBFzSE00QPLIDz/rSaOYo+1Ijm5h58vTw80ZiMru1YNm8X+QvI18yBS5CWJrX3T5ynKrtv6U8uYJudRinqKHfa/TyH74BNyc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603732734183919.0808121020362; Mon, 26 Oct 2020 10:18:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.12477.32497 (Exim 4.92) (envelope-from ) id 1kX68l-00037u-5r; Mon, 26 Oct 2020 17:18:39 +0000 Received: by outflank-mailman (output) from mailman id 12477.32497; Mon, 26 Oct 2020 17:18:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68l-00037n-2D; Mon, 26 Oct 2020 17:18:39 +0000 Received: by outflank-mailman (input) for mailman id 12477; Mon, 26 Oct 2020 17:18:38 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68k-00032c-Lt for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:38 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 0ae8421b-87d0-4fbf-a03d-17c905b0a8ef; Mon, 26 Oct 2020 17:18:34 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B487139F; Mon, 26 Oct 2020 10:18:34 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCC1E3F719; Mon, 26 Oct 2020 10:18:32 -0700 (PDT) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68k-00032c-Lt for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:38 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 0ae8421b-87d0-4fbf-a03d-17c905b0a8ef; Mon, 26 Oct 2020 17:18:34 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B487139F; Mon, 26 Oct 2020 10:18:34 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BCC1E3F719; Mon, 26 Oct 2020 10:18:32 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0ae8421b-87d0-4fbf-a03d-17c905b0a8ef From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Paul Durrant , Kevin Tian Subject: [PATCH v1 2/4] xen/pci: Introduce new CONFIG_HAS_PCI_ATS flag for PCI ATS functionality. Date: Mon, 26 Oct 2020 17:17:52 +0000 Message-Id: <1bb971bed3f5a56b0691fbcfd0346ae721ba049f.1603731279.git.rahul.singh@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" PCI ATS functionality is not enabled and tested for ARM architecture but it is enabled for x86 and referenced in common passthrough/pci.c code. Therefore introducing the new flag to enable the ATS functionality for x86 only to avoid issues for ARM architecture. No functional change. Signed-off-by: Rahul Singh --- xen/arch/x86/Kconfig | 1 + xen/drivers/passthrough/ats.h | 24 ++++++++++++++++++++++++ xen/drivers/passthrough/vtd/x86/Makefile | 2 +- xen/drivers/passthrough/x86/Makefile | 2 +- xen/drivers/pci/Kconfig | 3 +++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 24868aa6ad..31906e9c97 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -20,6 +20,7 @@ config X86 select HAS_NS16550 select HAS_PASSTHROUGH select HAS_PCI + select HAS_PCI_ATS select HAS_PDX select HAS_SCHED_GRANULARITY select HAS_UBSAN diff --git a/xen/drivers/passthrough/ats.h b/xen/drivers/passthrough/ats.h index 22ae209b37..a0af07b287 100644 --- a/xen/drivers/passthrough/ats.h +++ b/xen/drivers/passthrough/ats.h @@ -17,6 +17,8 @@ =20 #include =20 +#ifdef CONFIG_HAS_PCI_ATS + #define ATS_REG_CAP 4 #define ATS_REG_CTL 6 #define ATS_QUEUE_DEPTH_MASK 0x1f @@ -48,5 +50,27 @@ static inline int pci_ats_device(int seg, int bus, int d= evfn) return pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); } =20 +#else + +static inline int enable_ats_device(struct pci_dev *pdev, + struct list_head *ats_list) +{ + return -ENODEV; +} + +static inline void disable_ats_device(struct pci_dev *pdev) { } + +static inline int pci_ats_enabled(int seg, int bus, int devfn) +{ + return -ENODEV; +} + +static inline int pci_ats_device(int seg, int bus, int devfn) +{ + return -ENODEV; +} + +#endif /* CONFIG_HAS_PCI_ATS */ + #endif /* _ATS_H_ */ =20 diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthr= ough/vtd/x86/Makefile index 4ef00a4c5b..60f79fe263 100644 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ b/xen/drivers/passthrough/vtd/x86/Makefile @@ -1,3 +1,3 @@ -obj-y +=3D ats.o +obj-$(CONFIG_HAS_PCI_ATS) +=3D ats.o obj-$(CONFIG_HVM) +=3D hvm.o obj-y +=3D vtd.o diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough= /x86/Makefile index a70cf9460d..05e6f51f25 100644 --- a/xen/drivers/passthrough/x86/Makefile +++ b/xen/drivers/passthrough/x86/Makefile @@ -1,2 +1,2 @@ -obj-y +=3D ats.o +obj-$(CONFIG_HAS_PCI_ATS) +=3D ats.o obj-y +=3D iommu.o diff --git a/xen/drivers/pci/Kconfig b/xen/drivers/pci/Kconfig index 7da03fa13b..1588d4a91e 100644 --- a/xen/drivers/pci/Kconfig +++ b/xen/drivers/pci/Kconfig @@ -1,3 +1,6 @@ =20 config HAS_PCI bool + +config HAS_PCI_ATS + bool --=20 2.17.1 From nobody Sun May 5 22:41:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1603732741; cv=none; d=zohomail.com; s=zohoarc; b=HTzeinwn0IyCnhr742vgynqZg8cEiv6MJ2s7I36YgoucDSdp91qbnDHk+lWvzJ4OBSmw4MW42nQ2e1C3BTvqgPlpwzz8TO6M9RD/8zWggpVXQ4aumkvZyJ+Bog+zINSRDGZoVWkqyswQeFA+0x61AePNobJOtMoyv/geONIl4vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603732741; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=WjFskvFuqO8V81oFW64ei45y/CH6Vb3yUgXZNV+AMQg=; b=Njl6GgEpUJJpiHxTG6Pc1KBWyeSWaXjlH472eFnUDr4RA4zEExjYiark00aJloAbi8ONYwwRlsRXfOQw/RV4O7tEd099KQcfbP4vLhFYVkjxR76uGKn2djwBphxFoDEk04C6MkbOup5Mk+3RHwuuTJePOp/lBfeHxX7LyjtxgIM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603732741668856.3481641861011; Mon, 26 Oct 2020 10:19:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.12479.32510 (Exim 4.92) (envelope-from ) id 1kX68q-0003CC-EB; Mon, 26 Oct 2020 17:18:44 +0000 Received: by outflank-mailman (output) from mailman id 12479.32510; Mon, 26 Oct 2020 17:18:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68q-0003C2-AU; Mon, 26 Oct 2020 17:18:44 +0000 Received: by outflank-mailman (input) for mailman id 12479; Mon, 26 Oct 2020 17:18:43 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68p-00032c-M8 for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:43 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id ced3ab88-a6e7-48e9-bba0-d7e449761653; Mon, 26 Oct 2020 17:18:38 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD89D139F; Mon, 26 Oct 2020 10:18:37 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60E553F719; Mon, 26 Oct 2020 10:18:36 -0700 (PDT) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68p-00032c-M8 for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:43 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id ced3ab88-a6e7-48e9-bba0-d7e449761653; Mon, 26 Oct 2020 17:18:38 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD89D139F; Mon, 26 Oct 2020 10:18:37 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60E553F719; Mon, 26 Oct 2020 10:18:36 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ced3ab88-a6e7-48e9-bba0-d7e449761653 From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, Jan Beulich , Paul Durrant , Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v1 3/4] xen/pci: Move x86 specific code to x86 directory. Date: Mon, 26 Oct 2020 17:17:53 +0000 Message-Id: <70029e8904170c4f19d9f521847050cd00c6e39d.1603731279.git.rahul.singh@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" passthrough/pci.c file is common for all architecture, but there is x86 sepcific code in this file. Move x86 specific code to the x86 directory to avoid compilation error for other architecture. No functional change. Signed-off-by: Rahul Singh --- xen/drivers/passthrough/pci.c | 75 +-------------------- xen/drivers/passthrough/x86/Makefile | 1 + xen/drivers/passthrough/x86/iommu.c | 7 ++ xen/drivers/passthrough/x86/pci.c | 97 ++++++++++++++++++++++++++++ xen/include/xen/pci.h | 2 + 5 files changed, 108 insertions(+), 74 deletions(-) create mode 100644 xen/drivers/passthrough/x86/pci.c diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 2a3bce1462..c6fbb7172c 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -847,71 +846,6 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn) return ret; } =20 -static int pci_clean_dpci_irq(struct domain *d, - struct hvm_pirq_dpci *pirq_dpci, void *arg) -{ - struct dev_intx_gsi_link *digl, *tmp; - - pirq_guest_unbind(d, dpci_pirq(pirq_dpci)); - - if ( pt_irq_need_timer(pirq_dpci->flags) ) - kill_timer(&pirq_dpci->timer); - - list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list ) - { - list_del(&digl->list); - xfree(digl); - } - - radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq); - - if ( !pt_pirq_softirq_active(pirq_dpci) ) - return 0; - - domain_get_irq_dpci(d)->pending_pirq_dpci =3D pirq_dpci; - - return -ERESTART; -} - -static int pci_clean_dpci_irqs(struct domain *d) -{ - struct hvm_irq_dpci *hvm_irq_dpci =3D NULL; - - if ( !is_iommu_enabled(d) ) - return 0; - - if ( !is_hvm_domain(d) ) - return 0; - - spin_lock(&d->event_lock); - hvm_irq_dpci =3D domain_get_irq_dpci(d); - if ( hvm_irq_dpci !=3D NULL ) - { - int ret =3D 0; - - if ( hvm_irq_dpci->pending_pirq_dpci ) - { - if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) ) - ret =3D -ERESTART; - else - hvm_irq_dpci->pending_pirq_dpci =3D NULL; - } - - if ( !ret ) - ret =3D pt_pirq_iterate(d, pci_clean_dpci_irq, NULL); - if ( ret ) - { - spin_unlock(&d->event_lock); - return ret; - } - - hvm_domain_irq(d)->dpci =3D NULL; - free_hvm_irq_dpci(hvm_irq_dpci); - } - spin_unlock(&d->event_lock); - return 0; -} - /* Caller should hold the pcidevs_lock */ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus, uint8_t devfn) @@ -971,7 +905,7 @@ int pci_release_devices(struct domain *d) int ret; =20 pcidevs_lock(); - ret =3D pci_clean_dpci_irqs(d); + ret =3D arch_pci_release_devices(d); if ( ret ) { pcidevs_unlock(); @@ -1375,13 +1309,6 @@ static int __init setup_dump_pcidevs(void) } __initcall(setup_dump_pcidevs); =20 -int iommu_update_ire_from_msi( - struct msi_desc *msi_desc, struct msi_msg *msg) -{ - return iommu_intremap - ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : = 0; -} - static int iommu_add_device(struct pci_dev *pdev) { const struct domain_iommu *hd; diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough= /x86/Makefile index 05e6f51f25..642f673ed2 100644 --- a/xen/drivers/passthrough/x86/Makefile +++ b/xen/drivers/passthrough/x86/Makefile @@ -1,2 +1,3 @@ obj-$(CONFIG_HAS_PCI_ATS) +=3D ats.o obj-y +=3D iommu.o +obj-y +=3D pci.o diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index f17b1820f4..875e67b53b 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -308,6 +308,13 @@ struct page_info *iommu_alloc_pgtable(struct domain *d) return pg; } =20 +int iommu_update_ire_from_msi( + struct msi_desc *msi_desc, struct msi_msg *msg) +{ + return iommu_intremap + ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : = 0; +} + /* * Local variables: * mode: C diff --git a/xen/drivers/passthrough/x86/pci.c b/xen/drivers/passthrough/x8= 6/pci.c new file mode 100644 index 0000000000..443712aa22 --- /dev/null +++ b/xen/drivers/passthrough/x86/pci.c @@ -0,0 +1,97 @@ +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License f= or + * more details. + * + * You should have received a copy of the GNU General Public License along= with + * this program; If not, see . + */ + +#include +#include +#include +#include + +static int pci_clean_dpci_irq(struct domain *d, + struct hvm_pirq_dpci *pirq_dpci, void *arg) +{ + struct dev_intx_gsi_link *digl, *tmp; + + pirq_guest_unbind(d, dpci_pirq(pirq_dpci)); + + if ( pt_irq_need_timer(pirq_dpci->flags) ) + kill_timer(&pirq_dpci->timer); + + list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list ) + { + list_del(&digl->list); + xfree(digl); + } + + radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq); + + if ( !pt_pirq_softirq_active(pirq_dpci) ) + return 0; + + domain_get_irq_dpci(d)->pending_pirq_dpci =3D pirq_dpci; + + return -ERESTART; +} + +static int pci_clean_dpci_irqs(struct domain *d) +{ + struct hvm_irq_dpci *hvm_irq_dpci =3D NULL; + + if ( !is_iommu_enabled(d) ) + return 0; + + if ( !is_hvm_domain(d) ) + return 0; + + spin_lock(&d->event_lock); + hvm_irq_dpci =3D domain_get_irq_dpci(d); + if ( hvm_irq_dpci !=3D NULL ) + { + int ret =3D 0; + + if ( hvm_irq_dpci->pending_pirq_dpci ) + { + if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) ) + ret =3D -ERESTART; + else + hvm_irq_dpci->pending_pirq_dpci =3D NULL; + } + + if ( !ret ) + ret =3D pt_pirq_iterate(d, pci_clean_dpci_irq, NULL); + if ( ret ) + { + spin_unlock(&d->event_lock); + return ret; + } + + hvm_domain_irq(d)->dpci =3D NULL; + free_hvm_irq_dpci(hvm_irq_dpci); + } + spin_unlock(&d->event_lock); + return 0; +} + +int arch_pci_release_devices(struct domain *d) +{ + return pci_clean_dpci_irqs(d); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 2bc4aaf453..13ae7cc2a5 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -212,4 +212,6 @@ int msixtbl_pt_register(struct domain *, struct pirq *,= uint64_t gtable); void msixtbl_pt_unregister(struct domain *, struct pirq *); void msixtbl_pt_cleanup(struct domain *d); =20 +int arch_pci_release_devices(struct domain *d); + #endif /* __XEN_PCI_H__ */ --=20 2.17.1 From nobody Sun May 5 22:41:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1603732743; cv=none; d=zohomail.com; s=zohoarc; b=Z0J2Myg9h10FDRofZ9i6jZkNPea/HpiX5eMU+DlbzMGCh9/ARin+VMTdkk7b2VqhbuXS8qeKTR/iEZOAZ6RP0nI8/CYmsKrkcqg51NT4tmuF86rdmcPUr4YHWXO6EgoQRgb71RgNK4tHiMZYMFW9idtbfp6YzNnhM4z6tVo7Tg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603732743; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=6QzQ8tgJ1sfZqQB5eDki3v5bpaQyGaViE7+a/sDiE9w=; b=aN+UaMDr6nBXLIEendbKE3rvj/ZzC44/LO11TiJb35WC8/wik2nRwWeZP63tWobucSkufXzheu8LUyQESenFfPhpoSogVyfBW8o0q5m5LbCTB0SobzES2ituKyDaPHrQKRjH57r+si+a2nDVNesDXcwdgHk7S5g4vfLoaGzres8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16037327435029.795306134240604; Mon, 26 Oct 2020 10:19:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.12480.32522 (Exim 4.92) (envelope-from ) id 1kX68v-0003Gz-Ms; Mon, 26 Oct 2020 17:18:49 +0000 Received: by outflank-mailman (output) from mailman id 12480.32522; Mon, 26 Oct 2020 17:18:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68v-0003Gr-JE; Mon, 26 Oct 2020 17:18:49 +0000 Received: by outflank-mailman (input) for mailman id 12480; Mon, 26 Oct 2020 17:18:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68u-00032c-MT for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:48 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id bc3f38fb-0759-475f-96b7-c29d22c77b32; Mon, 26 Oct 2020 17:18:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0CA6213A1; Mon, 26 Oct 2020 10:18:40 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D0DA3F719; Mon, 26 Oct 2020 10:18:39 -0700 (PDT) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kX68u-00032c-MT for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 17:18:48 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id bc3f38fb-0759-475f-96b7-c29d22c77b32; Mon, 26 Oct 2020 17:18:40 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0CA6213A1; Mon, 26 Oct 2020 10:18:40 -0700 (PDT) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D0DA3F719; Mon, 26 Oct 2020 10:18:39 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bc3f38fb-0759-475f-96b7-c29d22c77b32 From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, Jan Beulich , Paul Durrant Subject: [PATCH v1 4/4] xen/pci: solve compilation error when memory paging is not enabled. Date: Mon, 26 Oct 2020 17:17:54 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" d->vm_event_paging struct is defined under CONFIG_HAS_MEM_PAGING in sched.h but referenced in passthrough/pci.c directly. If CONFIG_HAS_MEM_PAGING is not enabled for architecture, compiler will throws an error. No functional change. Signed-off-by: Rahul Singh --- xen/drivers/passthrough/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index c6fbb7172c..3125c23e87 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1419,13 +1419,15 @@ static int assign_device(struct domain *d, u16 seg,= u8 bus, u8 devfn, u32 flag) if ( !is_iommu_enabled(d) ) return 0; =20 - /* Prevent device assign if mem paging or mem sharing have been=20 +#if defined(CONFIG_HAS_MEM_PAGING) || defined(CONFIG_MEM_SHARING) + /* Prevent device assign if mem paging or mem sharing have been * enabled for this domain */ if ( d !=3D dom_io && unlikely(mem_sharing_enabled(d) || vm_event_check_ring(d->vm_event_paging) || p2m_get_hostp2m(d)->global_logdirty) ) return -EXDEV; +#endif =20 /* device_assigned() should already have cleared the device for assign= ment */ ASSERT(pcidevs_locked()); --=20 2.17.1