From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail177-18.suw61.mandrillapp.com (mail177-18.suw61.mandrillapp.com [198.2.177.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A4E31AB539 for ; Mon, 17 Jun 2024 13:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.2.177.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718631389; cv=none; b=htk4abUc8jioJvEHzxMVHEYbx2qMR/bvEQp5qlLTJQA7pBWZGRSuOC4ICExMxZT/5p6EPnB9mcLFyVXmEWXYKlKao/PtsY5KfnZ+aN91EPeA+ScIwIg4zpan5Y9CfQdCDsxH0qn/s2k+MFcPAWUUfB7SH0pqSHS4XouO2SrofRg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718631389; c=relaxed/simple; bh=dlpIz9pqe9DLQUjEyyFOte2v8iurHUanjdc8c6ML0Xg=; h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Date: MIME-Version:Content-Type; b=SAUI+qwN4q85K1gw+Z/gFH/M0G5TrPm+6EiVivMqUMfpZGknAs3pxzGAN4kwLmkMYOQSMBHGLWVUfC7o1eL0MJVWnSdpvgqLFa6CxpoUbkoCxXfMaIyaaoN7f+ExYqZW1kF3jQLDn+h5qiOwfOPKksFheczA1clBW437D3kNEa8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vates.tech; spf=pass smtp.mailfrom=bounce.vates.tech; dkim=pass (2048-bit key) header.d=mandrillapp.com header.i=@mandrillapp.com header.b=vVPXRYXP; dkim=pass (2048-bit key) header.d=vates.tech header.i=teddy.astie@vates.tech header.b=KH2Jnvp7; arc=none smtp.client-ip=198.2.177.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vates.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bounce.vates.tech Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mandrillapp.com header.i=@mandrillapp.com header.b="vVPXRYXP"; dkim=pass (2048-bit key) header.d=vates.tech header.i=teddy.astie@vates.tech header.b="KH2Jnvp7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1718631386; x=1718891886; bh=ANoB2hVLGG/+0YUoUyUuDSxhyaDSfD0W7DFkZ5zOFpI=; h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=vVPXRYXPPiFH2OCXAZqdcxjNY4DgvShhBF2BjdWfNHuXVlgJUuax66yPEOWYP8xuW ZcT0sZImDK8u41AYRWoxsBp85kyJ7votQF9T0Ri/2n2KlOkoPez1RfE3NqW6pYn2hS j3AUo6pHG9o+6w5IXr+Wh3Jo13wMg6v94mfmO5yfsapQHBTtWNRPq/mLnT2UM/KQks jZDC5nn8Nytx38tpANFwBwMcCkX7q8P+B3wZPahtYxqAeXYs8RDjrdsEAmAdv5puJ/ ozUwQkiuleDhTQmaaDNkW+/wo+uZ86z69Y/cscykgLFDO7h/mGjIixZjNTnAAee9A4 j/R/VME0Ni8Iw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1718631386; x=1718891886; i=teddy.astie@vates.tech; bh=ANoB2hVLGG/+0YUoUyUuDSxhyaDSfD0W7DFkZ5zOFpI=; h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=KH2Jnvp7N8SwtNomIlWXPofeORixyzzRU2PDJ59cKhz4UtgN9Withx/dTjs2un4e3 TF5FBifUfRFlEn6DqY8l3H1L+ovK2ctFcXXzTsQBBUInZ+ejqD/ZQSswnp9xIJBsvE FiVqIQvN/GzzpH2PIJg132oI/WIUUSb0FAouSEUvfhs5i8Lmr7nMNYc4f/hKniRrK8 3gjQVqcSs6Wc/c8iRSGOxrL+CD8iU4t+0UoNs+Bs6Vsd5cuf5IZ1Vy+8OjzBHlZTfA 1v2u3us7CwOynZBRRj2nKr6Z5zS8878QsR7CyO2E/7XTe3x1gV8mVDZL4DPdeCeloz 7oiBXgihSZitQ== Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail177-18.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4W2rWZ6ZXwzCf9KFL for ; Mon, 17 Jun 2024 13:36:26 +0000 (GMT) From: Teddy Astie Subject: =?utf-8?Q?Re:=20[RFC=20PATCH]=20iommu/xen:=20Add=20Xen=20PV-IOMMU=20driver?= Received: from [37.26.189.201] by mandrillapp.com id 6bf0bf7186334d4da354f2a8f89a4b92; Mon, 17 Jun 2024 13:36:26 +0000 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1718631384460 Message-Id: To: Jan Beulich Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Joerg Roedel , Will Deacon , Robin Murphy , =?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?= , xen-devel@lists.xenproject.org, iommu@lists.linux.dev References: <8b0151a8-2293-409a-8469-d9e73cf561a3@suse.com> In-Reply-To: <8b0151a8-2293-409a-8469-d9e73cf561a3@suse.com> X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.6bf0bf7186334d4da354f2a8f89a4b92?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240617:md Date: Mon, 17 Jun 2024 13:36:26 +0000 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le 13/06/2024 =C3=A0 16:32, Jan Beulich a =C3=A9crit=C2=A0: > On 13.06.2024 15:50, Teddy Astie wrote: >> @@ -214,6 +215,38 @@ struct xen_add_to_physmap_range { >> }; >> DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); >> >> +/* >> + * With some legacy devices, certain guest-physical addresses cannot sa= fely >> + * be used for other purposes, e.g. to map guest RAM. This hypercall >> + * enumerates those regions so the toolstack can avoid using them. >> + */ >> +#define XENMEM_reserved_device_memory_map 27 >> +struct xen_reserved_device_memory { >> + xen_pfn_t start_pfn; >> + xen_ulong_t nr_pages; >> +}; >> +DEFINE_GUEST_HANDLE_STRUCT(xen_reserved_device_memory); >> + >> +struct xen_reserved_device_memory_map { >> +#define XENMEM_RDM_ALL 1 /* Request all regions (ignore dev union). */ >> + /* IN */ >> + uint32_t flags; >> + /* >> + * IN/OUT >> + * >> + * Gets set to the required number of entries when too low, >> + * signaled by error code -ERANGE. >> + */ >> + unsigned int nr_entries; >> + /* OUT */ >> + GUEST_HANDLE(xen_reserved_device_memory) buffer; >> + /* IN */ >> + union { >> + struct physdev_pci_device pci; >> + } dev; >> +}; >> +DEFINE_GUEST_HANDLE_STRUCT(xen_reserved_device_memory_map); > > This is a tools-only (i.e. unstable) sub-function in Xen; even the commen= t > at the top says "toolstack". It is therefore not suitable for use in a > kernel. > IMO this comment actually describes how the toolstack uses the hypercall, but I don't think it is actually reserved for toolstack use. Or maybe we should allow the kernel to use this hypercall as well. >> + >> +/* >> + * Local variables: >> + * mode: C >> + * c-file-style: "BSD" >> + * c-basic-offset: 4 >> + * tab-width: 4 >> + * indent-tabs-mode: nil >> + * End: >> + */ >> \ No newline at end of file > > Nit: I'm pretty sure you want to avoid this. > Indeed. Teddy Teddy Astie | Vates XCP-ng Intern XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3DDDC27C79 for ; Mon, 17 Jun 2024 13:36:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.742285.1149047 (Exim 4.92) (envelope-from ) id 1sJCXA-00046H-0i; Mon, 17 Jun 2024 13:36:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 742285.1149047; Mon, 17 Jun 2024 13:36:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJCX9-00046A-U7; Mon, 17 Jun 2024 13:36:31 +0000 Received: by outflank-mailman (input) for mailman id 742285; Mon, 17 Jun 2024 13:36:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJCX8-000464-FW for xen-devel@lists.xenproject.org; Mon, 17 Jun 2024 13:36:30 +0000 Received: from mail177-18.suw61.mandrillapp.com (mail177-18.suw61.mandrillapp.com [198.2.177.18]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 991a80fa-2cae-11ef-90a3-e314d9c70b13; Mon, 17 Jun 2024 15:36:28 +0200 (CEST) Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail177-18.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4W2rWb0ZFYzCf9KH4 for ; Mon, 17 Jun 2024 13:36:27 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 596ddebcd27e4a80866745c63510b597; Mon, 17 Jun 2024 13:36:27 +0000 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: 991a80fa-2cae-11ef-90a3-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1718631387; x=1718891887; bh=ANoB2hVLGG/+0YUoUyUuDSxhyaDSfD0W7DFkZ5zOFpI=; h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=WV7YF7M8wSLvI1P7Rwq1vgjWkhIOQD+PDZtKFfG+2thNNZeoDgBMzEDSJ5kpzXTpx 4Pc8KI3BLOGx/MkgGyNCuiwYiOSQmbcpwo6NP1zX9qtWpp/5TicGsuJ+0CZexP5tAj BHAwIrphRTaSBqMAxwsL80/tZO1dQ/sQNyoKmuXOcSgX7RufGEiW/m3AH+u918yTaL Xj2dHQeYRN8mQQ9d7i9gcC5GgImQOL81vQ1wpZsJ6FIWAe4M8Jvg5J4Y1YKI9jJzTg WVDpIr3WmKg+BWOLwa3m7zE1bVJz1W0Pm3pxwRH66ShuJlTJuNKOKHTZdsNf394iSr zCPXUsTqxROeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1718631387; x=1718891887; i=teddy.astie@vates.tech; bh=ANoB2hVLGG/+0YUoUyUuDSxhyaDSfD0W7DFkZ5zOFpI=; h=From:Subject:Message-Id:To:Cc:References:In-Reply-To:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=vZYWjYSF7bPtrzdw7uEFljrrEWqYsXzWG1x/bq5zkvfGbs1lewOxLqFD5EnHS3Yhg 92lhKeshbjIUZrSaSGvl0iLvTkyo/TypSCJp6pNJg9/wbOcUziSt6b9Mt3GbnF+eJ3 /ItfQxxwqpy2qHyYDAgFTLzQC47rzcI2q3h2Dub++8NYiccaPOimS77Rvrnx7RjNkR cKHO9IhQaGTIKACjwpUVWGph4Kz/LIhueO399QXzUPFDON48RbBQQO3X/fAVNS8fxc 7aU1MqwVwWztIyx/RnV2u+y60FoleBV7FEDA13BruCfMAkypLeYhT3qTrEaxXtQ3dA o/G8tkfC6PmXw== From: Teddy Astie Subject: =?utf-8?Q?Re:=20[RFC=20PATCH]=20iommu/xen:=20Add=20Xen=20PV-IOMMU=20driver?= X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1718631384460 Message-Id: To: Jan Beulich Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Joerg Roedel , Will Deacon , Robin Murphy , =?utf-8?Q?Marek=20Marczykowski-G=C3=B3recki?= , xen-devel@lists.xenproject.org, iommu@lists.linux.dev References: <8b0151a8-2293-409a-8469-d9e73cf561a3@suse.com> In-Reply-To: <8b0151a8-2293-409a-8469-d9e73cf561a3@suse.com> X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.596ddebcd27e4a80866745c63510b597?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240617:md Date: Mon, 17 Jun 2024 13:36:27 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le 13/06/2024 =C3=A0 16:32, Jan Beulich a =C3=A9crit=C2=A0: > On 13.06.2024 15:50, Teddy Astie wrote: >> @@ -214,6 +215,38 @@ struct xen_add_to_physmap_range { >> }; >> DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); >> >> +/* >> + * With some legacy devices, certain guest-physical addresses cannot sa= fely >> + * be used for other purposes, e.g. to map guest RAM. This hypercall >> + * enumerates those regions so the toolstack can avoid using them. >> + */ >> +#define XENMEM_reserved_device_memory_map 27 >> +struct xen_reserved_device_memory { >> + xen_pfn_t start_pfn; >> + xen_ulong_t nr_pages; >> +}; >> +DEFINE_GUEST_HANDLE_STRUCT(xen_reserved_device_memory); >> + >> +struct xen_reserved_device_memory_map { >> +#define XENMEM_RDM_ALL 1 /* Request all regions (ignore dev union). */ >> + /* IN */ >> + uint32_t flags; >> + /* >> + * IN/OUT >> + * >> + * Gets set to the required number of entries when too low, >> + * signaled by error code -ERANGE. >> + */ >> + unsigned int nr_entries; >> + /* OUT */ >> + GUEST_HANDLE(xen_reserved_device_memory) buffer; >> + /* IN */ >> + union { >> + struct physdev_pci_device pci; >> + } dev; >> +}; >> +DEFINE_GUEST_HANDLE_STRUCT(xen_reserved_device_memory_map); > > This is a tools-only (i.e. unstable) sub-function in Xen; even the commen= t > at the top says "toolstack". It is therefore not suitable for use in a > kernel. > IMO this comment actually describes how the toolstack uses the hypercall, but I don't think it is actually reserved for toolstack use. Or maybe we should allow the kernel to use this hypercall as well. >> + >> +/* >> + * Local variables: >> + * mode: C >> + * c-file-style: "BSD" >> + * c-basic-offset: 4 >> + * tab-width: 4 >> + * indent-tabs-mode: nil >> + * End: >> + */ >> \ No newline at end of file > > Nit: I'm pretty sure you want to avoid this. > Indeed. Teddy Teddy Astie | Vates XCP-ng Intern XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech