Re: [PATCH 7/9] iommu/amd: Add ioapic and hpet ivrs override

2013-04-12 Thread Joerg Roedel
On Thu, Apr 11, 2013 at 04:40:07PM -0500, Suthikulpanit, Suravee wrote:
> On 4/9/2013 3:29 PM, Joerg Roedel wrote:
> >On Tue, Apr 09, 2013 at 10:13:02PM +0200, Joerg Roedel wrote:
> >>Add two new kernel commandline parameters ivrs_ioapic and
> >>ivrs_hpet to override the Id->DeviceId mapping from the IVRS
> >>ACPI table. This can be used to work around broken BIOSes to
> >>get interrupt remapping working on AMD systems.
> >>
> >>Signed-off-by: Joerg Roedel 
> >Forgot to add:
> >
> >Tested-by: Borislav Petkov 
> I also tested on some other systems here and the patch works also.

Cool, thanks for testing. I'll add your

Tested-by: Suravee Suthikulanit 


Joerg


___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 7/9] iommu/amd: Add ioapic and hpet ivrs override

2013-04-11 Thread Suravee Suthikulanit

On 4/9/2013 3:29 PM, Joerg Roedel wrote:

On Tue, Apr 09, 2013 at 10:13:02PM +0200, Joerg Roedel wrote:

Add two new kernel commandline parameters ivrs_ioapic and
ivrs_hpet to override the Id->DeviceId mapping from the IVRS
ACPI table. This can be used to work around broken BIOSes to
get interrupt remapping working on AMD systems.

Signed-off-by: Joerg Roedel 

Forgot to add:

Tested-by: Borislav Petkov 

I also tested on some other systems here and the patch works also.

Suravee

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu




___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 7/9] iommu/amd: Add ioapic and hpet ivrs override

2013-04-09 Thread Joerg Roedel
On Tue, Apr 09, 2013 at 10:13:02PM +0200, Joerg Roedel wrote:
> Add two new kernel commandline parameters ivrs_ioapic and
> ivrs_hpet to override the Id->DeviceId mapping from the IVRS
> ACPI table. This can be used to work around broken BIOSes to
> get interrupt remapping working on AMD systems.
> 
> Signed-off-by: Joerg Roedel 

Forgot to add:

Tested-by: Borislav Petkov 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH 7/9] iommu/amd: Add ioapic and hpet ivrs override

2013-04-09 Thread Joerg Roedel
Add two new kernel commandline parameters ivrs_ioapic and
ivrs_hpet to override the Id->DeviceId mapping from the IVRS
ACPI table. This can be used to work around broken BIOSes to
get interrupt remapping working on AMD systems.

Signed-off-by: Joerg Roedel 
---
 drivers/iommu/amd_iommu_init.c |   64 ++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 2a3b1b1..030d6ab 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2145,8 +2145,68 @@ static int __init parse_amd_iommu_options(char *str)
return 1;
 }
 
-__setup("amd_iommu_dump", parse_amd_iommu_dump);
-__setup("amd_iommu=", parse_amd_iommu_options);
+static int __init parse_ivrs_ioapic(char *str)
+{
+   unsigned int bus, dev, fn;
+   int ret, id, i;
+   u16 devid;
+
+   ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
+
+   if (ret != 4) {
+   pr_err("AMD-Vi: Invalid command line: ivrs_ioapic%s\n", str);
+   return 1;
+   }
+
+   if (early_ioapic_map_size == EARLY_MAP_SIZE) {
+   pr_err("AMD-Vi: Early IOAPIC map overflow - ignoring 
ivrs_ioapic%s\n",
+   str);
+   return 1;
+   }
+
+   devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
+
+   i   = early_ioapic_map_size++;
+   early_ioapic_map[i].id  = id;
+   early_ioapic_map[i].devid   = devid;
+   early_ioapic_map[i].cmd_line= true;
+
+   return 1;
+}
+
+static int __init parse_ivrs_hpet(char *str)
+{
+   unsigned int bus, dev, fn;
+   int ret, id, i;
+   u16 devid;
+
+   ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
+
+   if (ret != 4) {
+   pr_err("AMD-Vi: Invalid command line: ivrs_hpet%s\n", str);
+   return 1;
+   }
+
+   if (early_hpet_map_size == EARLY_MAP_SIZE) {
+   pr_err("AMD-Vi: Early HPET map overflow - ignoring 
ivrs_hpet%s\n",
+   str);
+   return 1;
+   }
+
+   devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
+
+   i   = early_hpet_map_size++;
+   early_hpet_map[i].id= id;
+   early_hpet_map[i].devid = devid;
+   early_hpet_map[i].cmd_line  = true;
+
+   return 1;
+}
+
+__setup("amd_iommu_dump",  parse_amd_iommu_dump);
+__setup("amd_iommu=",  parse_amd_iommu_options);
+__setup("ivrs_ioapic", parse_ivrs_ioapic);
+__setup("ivrs_hpet",   parse_ivrs_hpet);
 
 IOMMU_INIT_FINISH(amd_iommu_detect,
  gart_iommu_hole_init,
-- 
1.7.9.5


___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu