[PATCH v2 3/5] vtd: Collapse x86 subdirectory

Teddy Astie posted 5 patches 6 days, 12 hours ago
[PATCH v2 3/5] vtd: Collapse x86 subdirectory
Posted by Teddy Astie 6 days, 12 hours ago
The x86 subdirectory was originally meant to split x86-specific logic from
general VT-d code. Today, Xen only supports VT-d on x86 and the code actually
implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86
specific).

As ats.c is the only remaining file in this directory, and isn't x86 specific,
move it up to vtd directory and remove the now empty x86 subdirectory.

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
v2:
 - reviewed commit description

 xen/drivers/passthrough/vtd/Makefile        |  3 +--
 xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++-----
 xen/drivers/passthrough/vtd/x86/Makefile    |  1 -
 3 files changed, 6 insertions(+), 8 deletions(-)
 rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%)
 delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile

diff --git a/xen/drivers/passthrough/vtd/Makefile b/xen/drivers/passthrough/vtd/Makefile
index fde7555fac..328a014016 100644
--- a/xen/drivers/passthrough/vtd/Makefile
+++ b/xen/drivers/passthrough/vtd/Makefile
@@ -1,5 +1,4 @@
-obj-$(CONFIG_X86) += x86/
-
+obj-y += ats.o
 obj-y += iommu.o
 obj-y += dmar.o
 obj-y += utils.o
diff --git a/xen/drivers/passthrough/vtd/x86/ats.c b/xen/drivers/passthrough/vtd/ats.c
similarity index 97%
rename from xen/drivers/passthrough/vtd/x86/ats.c
rename to xen/drivers/passthrough/vtd/ats.c
index fed3588e8e..3b7c4028a6 100644
--- a/xen/drivers/passthrough/vtd/x86/ats.c
+++ b/xen/drivers/passthrough/vtd/ats.c
@@ -23,11 +23,11 @@
 #include <xen/pci.h>
 #include <xen/pci_regs.h>
 #include <asm/msi.h>
-#include "../iommu.h"
-#include "../dmar.h"
-#include "../vtd.h"
-#include "../extern.h"
-#include "../../ats.h"
+#include "iommu.h"
+#include "dmar.h"
+#include "vtd.h"
+#include "extern.h"
+#include "../ats.h"
 
 static LIST_HEAD(ats_dev_drhd_units);
 
diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile
deleted file mode 100644
index 82b3904a91..0000000000
--- a/xen/drivers/passthrough/vtd/x86/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-y += ats.o
\ No newline at end of file
-- 
2.51.1



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory
Posted by Jan Beulich 6 days, 11 hours ago
On 23.10.2025 11:12, Teddy Astie wrote:
> The x86 subdirectory was originally meant to split x86-specific logic from
> general VT-d code. Today, Xen only supports VT-d on x86 and the code actually
> implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86
> specific).
> 
> As ats.c is the only remaining file in this directory, and isn't x86 specific,
> move it up to vtd directory and remove the now empty x86 subdirectory.
> 
> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
> ---
> v2:
>  - reviewed commit description
> 
>  xen/drivers/passthrough/vtd/Makefile        |  3 +--
>  xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++-----
>  xen/drivers/passthrough/vtd/x86/Makefile    |  1 -
>  3 files changed, 6 insertions(+), 8 deletions(-)
>  rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%)
>  delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile

I should have remembered this when looking at v1 already: While some of your
other changes go farther (and hence are likely preferable), this one I'd rather
not see go in. I'd favor respective pieces of what's still pending from
https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and
foremost because ATS really is not only not x86-specific - it's not VT-d-
specific either.

Jan
Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory
Posted by Teddy Astie 6 days, 9 hours ago
Le 23/10/2025 à 12:20, Jan Beulich a écrit :
> On 23.10.2025 11:12, Teddy Astie wrote:
>> The x86 subdirectory was originally meant to split x86-specific logic from
>> general VT-d code. Today, Xen only supports VT-d on x86 and the code actually
>> implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86
>> specific).
>>
>> As ats.c is the only remaining file in this directory, and isn't x86 specific,
>> move it up to vtd directory and remove the now empty x86 subdirectory.
>>
>> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
>> ---
>> v2:
>>   - reviewed commit description
>>
>>   xen/drivers/passthrough/vtd/Makefile        |  3 +--
>>   xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++-----
>>   xen/drivers/passthrough/vtd/x86/Makefile    |  1 -
>>   3 files changed, 6 insertions(+), 8 deletions(-)
>>   rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%)
>>   delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile
> 
> I should have remembered this when looking at v1 already: While some of your
> other changes go farther (and hence are likely preferable), this one I'd rather
> not see go in. I'd favor respective pieces of what's still pending from
> https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and
> foremost because ATS really is not only not x86-specific - it's not VT-d-
> specific either.

CC-ing Jason Andryuk now reviewer of AMD-Vi code and likely interested 
with https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html 
at least for the AMD part.

I wasn't aware of this pending series. And some of my patches overlap 
with some of these ones, so I guess we need to complete it and then I 
rebase mine on top of it.

> 
> Jan
> 



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory
Posted by Jan Beulich 6 days, 9 hours ago
On 23.10.2025 14:23, Teddy Astie wrote:
> Le 23/10/2025 à 12:20, Jan Beulich a écrit :
>> On 23.10.2025 11:12, Teddy Astie wrote:
>>> The x86 subdirectory was originally meant to split x86-specific logic from
>>> general VT-d code. Today, Xen only supports VT-d on x86 and the code actually
>>> implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86
>>> specific).
>>>
>>> As ats.c is the only remaining file in this directory, and isn't x86 specific,
>>> move it up to vtd directory and remove the now empty x86 subdirectory.
>>>
>>> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
>>> ---
>>> v2:
>>>   - reviewed commit description
>>>
>>>   xen/drivers/passthrough/vtd/Makefile        |  3 +--
>>>   xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++-----
>>>   xen/drivers/passthrough/vtd/x86/Makefile    |  1 -
>>>   3 files changed, 6 insertions(+), 8 deletions(-)
>>>   rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%)
>>>   delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile
>>
>> I should have remembered this when looking at v1 already: While some of your
>> other changes go farther (and hence are likely preferable), this one I'd rather
>> not see go in. I'd favor respective pieces of what's still pending from
>> https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and
>> foremost because ATS really is not only not x86-specific - it's not VT-d-
>> specific either.
> 
> CC-ing Jason Andryuk now reviewer of AMD-Vi code and likely interested 
> with https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html 
> at least for the AMD part.
> 
> I wasn't aware of this pending series. And some of my patches overlap 
> with some of these ones, so I guess we need to complete it and then I 
> rebase mine on top of it.

It's going to be an intermix, I think. Your map/unmap changes are preferable
to mine, for example.

Jan