intel_iommu: fix VTD_SID_TO_BUS
PATCH 1/1 intel_iommu: fix VTD_SID_TO_BUS
(((sid) >> 8) && 0xff) makes no sense
(((sid) >> 8) & 0xff) seems to be what was meant.
---
Compile-tested only.
include/hw/i386/intel_iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/i386/intel_iommu.h +1 -1
@@ -37,7 +37,7 @@#define VTD_PCI_DEVFN_MAX 256#define VTD_PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define VTD_PCI_FUNC (devfn) ((devfn) & 0x07) -#define VTD_SID_TO_BUS (sid) (((sid) >> 8) && 0xff) +#define VTD_SID_TO_BUS (sid) (((sid) >> 8) & 0xff)#define VTD_SID_TO_DEVFN (sid) ((sid) & 0xff)#define DMAR_REG_SIZE 0x230
Signature · 1 line
MST
Quoted 4 lines · Michael S. Tsirkin
(((sid) >> 8) &&
0xff) makes no sense
(((sid) >> 8) &0xff) seems to be what was meant.Suggested-by Markus Armbruster <[email protected]>
Actually by the reporter of https://bugs.launchpad.net/bugs/1382477
Quoted 13 lines
Signed-off-by Michael S. Tsirkin <[email protected]>---
Compile-tested only.
include/hw/i386/intel_iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/i386/intel_iommu.h +0
-0
include/hw/i386/intel_iommu.h line 43
Quoted 8 lines
include/hw/i386/intel_iommu.h +1
-1@@ -37,7 +37,7 @@#define VTD_PCI_DEVFN_MAX 256#define VTD_PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define VTD_PCI_FUNC (devfn) ((devfn) & 0x07) -#define VTD_SID_TO_BUS (sid) (((sid) >> 8) && 0xff) +#define VTD_SID_TO_BUS (sid) (((sid) >> 8) & 0xff)#define VTD_SID_TO_DEVFN (sid) ((sid) & 0xff)#define DMAR_REG_SIZE 0x230
Can't find the spec right now, but it looks plausible enough.
Only use is in vtd_context_device_invalidate(). Bug's impact isn't obvious to me.
Hi Markus,
2014-10-20 19:41 GMT+08:00 Markus Armbruster <[email protected]>:
Quoted 29 lines
Quoted 4 lines · Michael S. Tsirkin
(((sid) >> 8) &&
0xff) makes no sense
(((sid) >> 8) &0xff) seems to be what was meant.Suggested-by Markus Armbruster <[email protected]>Actually by the reporter of https://bugs.launchpad.net/bugs/1382477
Quoted 20 lines
Signed-off-by Michael S. Tsirkin <[email protected]>---
Compile-tested only.
include/hw/i386/intel_iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/i386/intel_iommu.h +1
-1@@ -37,7 +37,7 @@#define VTD_PCI_DEVFN_MAX 256#define VTD_PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define VTD_PCI_FUNC (devfn) ((devfn) & 0x07) -#define VTD_SID_TO_BUS (sid) (((sid) >> 8) && 0xff) +#define VTD_SID_TO_BUS (sid) (((sid) >> 8) & 0xff)#define VTD_SID_TO_DEVFN (sid) ((sid) & 0xff)
Quoted 3 lines
include/hw/i386/intel_iommu.h line 43
Quoted 1 line
include/hw/i386/intel_iommu.h +0
-0#define DMAR_REG_SIZE 0x230Can't find the spec right now, but it looks plausible enough.
Yes, this is a typo. I am sorry that I introduced such a mistake. The spec is here in Section 3.4 :
http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/vt-directed-io-spec.html
VTD_SID_TO_BUS(sid) is intended to be used to get the bus id from the source identifier.
Thanks very much!
Regards,
Le
Quoted 4 lines
Only use is in
vtd_context_device_invalidate(). Bug's impact isn't obvious to me.Reviewed-by Markus Armbruster <[email protected]>
WRT intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.
Let's make it more complete and then enable for 2.3.
Thoughts?
Signature · 1 line
MST
Quoted 3 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped.
What is missing or broken?
Quoted 2 lines
People also discussed the best way to handle virtio versus iommu
(it bypasses it ATM).
We need to declare in the ACPI tables that the emulated IOMMUs do not cover those "special" virtio devices.
Quoted 6 lines
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.
Let's make it more complete and then enable for 2.3.
Thoughts?
We need the list of issues on the table, then we can decide.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Knut Omang
Reviewed-byQuoted 40 lines · On Mon, 2014-10-20 at 20:14 +0800, Le Tan wrote:
Hi Markus,
2014-10-20 19:41 GMT+08:00 Markus Armbruster <[email protected]>:
Quoted 29 lines
Quoted 4 lines · Michael S. Tsirkin
(((sid) >> 8) &&
0xff) makes no sense
(((sid) >> 8) &0xff) seems to be what was meant.Suggested-by Markus Armbruster <[email protected]>Actually by the reporter of https://bugs.launchpad.net/bugs/1382477
Quoted 20 lines
Signed-off-by Michael S. Tsirkin <[email protected]>---
Compile-tested only.
include/hw/i386/intel_iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/i386/intel_iommu.h +1
-1@@ -37,7 +37,7 @@#define VTD_PCI_DEVFN_MAX 256#define VTD_PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define VTD_PCI_FUNC (devfn) ((devfn) & 0x07) -#define VTD_SID_TO_BUS (sid) (((sid) >> 8) && 0xff) +#define VTD_SID_TO_BUS (sid) (((sid) >> 8) & 0xff)#define VTD_SID_TO_DEVFN (sid) ((sid) & 0xff)Quoted 3 lines
include/hw/i386/intel_iommu.h line 43
Quoted 1 line
include/hw/i386/intel_iommu.h +0
-0#define DMAR_REG_SIZE 0x230Can't find the spec right now, but it looks plausible enough.
Yes, this is a typo. I am sorry that I introduced such a mistake. The spec is here in Section 3.4 :
http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/vt-directed-io-spec.html
Quoted 10 lines
VTD_SID_TO_BUS(sid)is intended to be used to get the bus id from the source identifier.Thanks very much!
Regards,
LeQuoted 2 lines
Only use is in
vtd_context_device_invalidate(). Bug's impact isn't obvious to me.
It means that invalidation will not work as intended if a device is place on another bus than 01:xx.x (or 0 in theory) as this bus_num always evaluate to 1 or 0 as a boolean. I have been doing quite some testing of the virtual iommu, but by luck or unluck depending on viewpoint my device so far has always been in bus 1...
Note that input is always supposed to be a 16 bit value here so the and is in theory not really necessary unless from a documentation and precaution point of view.
Knut
Quoted 2 lines
Quoted 1 line
Reviewed-by Markus Armbruster <[email protected]>
Quoted 9 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.Let's make it more complete and then enable for 2.3.
Thoughts?
Note that you have to explicitly enable iommu support in the guest (intel_iommu=on on the boot command line in the Linux case) for it to have any effect apart from being visible in the DMAR table and logging so it should not really do any harm.
Quoted 1 line
From my perspective the feature works well and I have been running a few
virtual machines with div.network workload stable using the additional 4 patches referred to in this post (Jan's two for interrupt remapping and two bug fixes and enhancements from me for running behind bridges) :
https://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02986.html
Latest version here:
https://github.com/knuto/qemu/tree/sriov_patches_v2
Give me a hint and I can rebase and post the two iommu patches, I believe Jan wanted to do some more work on the interrupt remapping first.
Knut
Quoted 6 lines · Jan Kiszka
Quoted 3 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped.What is missing or broken?
PCI to PCI bridges don't work, do they?
Quoted 5 lines
Quoted 2 lines
People also discussed the best way to handle virtio versus iommu
(it bypasses it ATM).We need to declare in the ACPI tables that the emulated IOMMUs do not cover those "special" virtio devices.
I'd also be fine if we flat out disallow adding virtio devices to such systems for now, or anything else that does not work.
Patches for either approach aren't yet available, are they?
Quoted 14 lines
Quoted 6 lines
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.
Let's make it more complete and then enable for 2.3.
Thoughts?
We need the list of issues on the table, then we can decide.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 23 lines · Knut Omang
Quoted 9 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.Let's make it more complete and then enable for 2.3.
Thoughts?
Note that you have to explicitly enable iommu support in the guest (intel_iommu=on on the boot command line in the Linux case) for it to have any effect apart from being visible in the DMAR table and logging so it should not really do any harm.
From my perspective the feature works well and I have been running a few virtual machines with div.network workload stable using the additional 4 patches referred to in this post (Jan's two for interrupt remapping and two bug fixes and enhancements from me for running behind bridges) :
https://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02986.html
Quoted 7 lines
Latest version here:
https://github.com/knuto/qemu/tree/sriov_patches_v2
Give me a hint and I can rebase and post the two iommu patches, I believe Jan wanted to do some more work on the interrupt remapping first.
You should avoid to depend on my series regarding upstreaming of fixes or features that can be done independently. Did your bridging fixes depend on IR? Can you break them up?
Jan
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Jan Kiszka
Quoted 3 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped.What is missing or broken?
PCI to PCI bridges don't work, do they?
Knut had an answer, but there was something, right.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
People also discussed the best way to handle virtio versus iommu
(it bypasses it ATM).We need to declare in the ACPI tables that the emulated IOMMUs do not cover those "special" virtio devices.
I'd also be fine if we flat out disallow adding virtio devices to such systems for now, or anything else that does not work.
I wouldn't (heavily used in my test setups).
Quoted 1 line
Patches for either approach aren't yet available, are they?
If no one else is quicker, I'll look into the ACPI tables.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 28 lines · Jan Kiszka
Quoted 27 lines · Knut Omang
Quoted 9 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.Let's make it more complete and then enable for 2.3.
Thoughts?
Note that you have to explicitly enable iommu support in the guest (intel_iommu=on on the boot command line in the Linux case) for it to have any effect apart from being visible in the DMAR table and logging so it should not really do any harm.
From my perspective the feature works well and I have been running a few virtual machines with div.network workload stable using the additional 4 patches referred to in this post (Jan's two for interrupt remapping and two bug fixes and enhancements from me for running behind bridges) :
https://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02986.html
Latest version here:
Quoted 7 lines
Quoted 3 lines
Give me a hint and I can rebase and post the two iommu patches, I believe Jan wanted to do some more work on the interrupt remapping first.
You should avoid to depend on my series regarding upstreaming of fixes or features that can be done independently. Did your bridging fixes depend on IR? Can you break them up?
Yes, that was my intention with the comment (to rebase to make my two commits independent of your interrupt remapping commits) but I realize the language in my comment was not clear - sorry for the confusion,..
Knut
Quoted 23 lines · Knut Omang
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · Knut Omang
Quoted 9 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.Let's make it more complete and then enable for 2.3.
Thoughts?
Note that you have to explicitly enable iommu support in the guest (intel_iommu=on on the boot command line in the Linux case) for it to have any effect apart from being visible in the DMAR table and logging so it should not really do any harm.
From my perspective the feature works well and I have been running a few virtual machines with div.network workload stable using the additional 4 patches referred to in this post (Jan's two for interrupt remapping and two bug fixes and enhancements from me for running behind bridges) :
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
https://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02986.html
Latest version here:
Sorry, I just realized this branch was for the wrong patch set - rebasing now to repost just my two iommu fixes..
Knut
Quoted 15 lines
Quoted 7 lines
Quoted 3 lines
Give me a hint and I can rebase and post the two iommu patches, I believe Jan wanted to do some more work on the interrupt remapping first.
You should avoid to depend on my series regarding upstreaming of fixes or features that can be done independently. Did your bridging fixes depend on IR? Can you break them up?
Yes, that was my intention with the comment (to rebase to make my two commits independent of your interrupt remapping commits) but I realize the language in my comment was not clear - sorry for the confusion,..
Knut
Quoted 33 lines · Knut Omang
Quoted 32 lines · Jan Kiszka
Quoted 30 lines · Knut Omang
Quoted 9 lines · Michael S. Tsirkin
WRT
intel_iommu, it does not yet seem to be as fully functional as I hoped. People also discussed the best way to handle virtio versus iommu (it bypasses it ATM).
I'd like to suggest we hide the iommu from the command line help for 2.2, this way people don't activate it mistakenly.Let's make it more complete and then enable for 2.3.
Thoughts?
Note that you have to explicitly enable iommu support in the guest (intel_iommu=on on the boot command line in the Linux case) for it to have any effect apart from being visible in the DMAR table and logging so it should not really do any harm.
From my perspective the feature works well and I have been running a few virtual machines with div.network workload stable using the additional 4 patches referred to in this post (Jan's two for interrupt remapping and two bug fixes and enhancements from me for running behind bridges) :
https://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02986.html
Latest version here:
https://github.com/knuto/qemu/tree/sriov_patches_v2
Give me a hint and I can rebase and post the two iommu patches, I believe Jan wanted to do some more work on the interrupt remapping first.
Quoted 7 lines
Quoted 3 lines
You should avoid to depend on my series regarding upstreaming of fixes or features that can be done independently. Did your bridging fixes depend on IR? Can you break them up?
Yes, that was my intention with the comment (to rebase to make my two commits independent of your interrupt remapping commits) but I realize the language in my comment was not clear - sorry for the confusion,..
Jan,
https://github.com/knuto/qemu/tree/vtd_patches_v2
now contains my iommu fixes right on qemu master
(which I just posted to the list)
with your interrupt remapping patches rebased on top of this. This was a a bit of work after all so maybe you can save some time from that.
Knut