Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-10-07 Thread Jordan Hargrave
Ok updated the new changes. On Mon, Oct 05, 2020 at 09:54:02PM +0200, Mark Kettenis wrote: > > Date: Thu, 17 Sep 2020 20:54:51 -0500 > > From: Jordan Hargrave > > Cc: ma...@peereboom.org, kette...@openbsd.org, tech@openbsd.org, > > d...@openbsd.org, j...@open

Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-10-04 Thread Jordan Hargrave
Ping... still need more eyes on this This is the IOMMU code for VT-d and AMD Vi implementation It overrides the DMA Tag for each device and assigns it to a protected domain On Thu, Sep 17, 2020 at 08:54:51PM -0500, Jordan Hargrave wrote: > Ok made more changes > > On Mon, Sep 14, 2

Re: PATCH: Add vmmpci device for passthrough PCI

2020-10-04 Thread Jordan Hargrave
Ping. Can anyone review this? From: Jordan Hargrave Sent: Tuesday, September 15, 2020 12:54 PM To: tech@openbsd.org ; jor...@openbsd.org ; kette...@openbsd.org Subject: PATCH: Add vmmpci device for passthrough PCI This adds a placeholder vmmpci device that

Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-09-17 Thread Jordan Hargrave
Ok made more changes On Mon, Sep 14, 2020 at 08:19:18PM +0200, Mark Kettenis wrote: > > Date: Tue, 8 Sep 2020 21:43:39 -0500 > > From: Jordan Hargrave > > > > Made changes for the iommu_readq -> iommu_read_8 and also now > > dynamically allocate the hwdte f

Re: PATCH: Add vmmpci device for passthrough PCI

2020-09-17 Thread Jordan Hargrave
Ping. Any replies or commeents on this? On Tue, Sep 15, 2020 at 12:54:49PM -0500, Jordan Hargrave wrote: > This adds a placeholder vmmpci device that will be used for VMD passthrough > PCI. > > Normally the device will fail to attach unless the PCI domain:bus.dev.func has > been

PATCH: Add vmmpci device for passthrough PCI

2020-09-15 Thread Jordan Hargrave
$ */ +/* + * Copyright (c) 2020 Jordan Hargrave + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "

PATCH: Add ACPI IVHD_EXT structure to acpireg.h

2020-09-14 Thread Jordan Hargrave
This patch adds a couple of entries for AMD IOMMU structure definitions in ACPI Index: acpireg.h === RCS file: /cvs/src/sys/dev/acpi/acpireg.h,v retrieving revision 1.45 diff -u -p -r1.45 acpireg.h --- acpireg.h 28 Aug 2019 22:39:09

PATCH: Add cookie argument to pci_add_device/pci_add_bar for vmd, needed for PCI passthrough

2020-09-11 Thread Jordan Hargrave
This patch adds an extra size/cookie argument to pci_add_device and pci_add_bar. Changes required for implementing passthrough PCI. diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index 954235eb6..47a133b9a 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -39,6 +39,26 @@ extern cha

Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-09-08 Thread Jordan Hargrave
Made changes for the iommu_readq -> iommu_read_8 and also now dynamically allocate the hwdte for AMD IOMMU. On Fri, Sep 04, 2020 at 09:17:18PM +0200, Mark Kettenis wrote: > > Date: Fri, 4 Sep 2020 00:50:44 -0500 > > From: Jordan Hargrave > > A few hints below... > &g

PATCH: Add helper vm_find_vcpu function to VMD

2020-09-08 Thread Jordan Hargrave
>From cba617464c71f4d4e4a34728f117ca92145f746f Mon Sep 17 00:00:00 2001 From: Jordan Hargrave Date: Tue, 18 Aug 2020 15:46:36 -0500 Subject: [PATCH 1/4] Add helper vm_find_vcpu function for VMM --- sys/arch/amd64/amd64/vmm.c | 63 -- 1 file changed,

Re: PATCH: Fix PCI Config Space union size on VMM

2020-09-07 Thread Jordan Hargrave
This code fixes the pci device union for accessing PCI config space >= 0x40 Running pcidump -xxx in a virtual machine would return garbage data due to union overlap On Mon, Sep 07, 2020 at 05:52:55PM -0500, Jordan Hargrave wrote: > Index:

PATCH: Fix PCI Config Space union size on VMM

2020-09-07 Thread Jordan Hargrave
Index: pci.h === RCS file: /cvs/src/usr.sbin/vmd/pci.h,v retrieving revision 1.7 diff -u -p -u -r1.7 pci.h --- pci.h 17 Sep 2017 23:07:56 - 1.7 +++ pci.h 7 Sep 2020 22:48:09 - @@ -32,43 +32,44 @@ typedef int (*

Re: [PATCH] Add common PCIE capability list

2020-09-07 Thread Jordan Hargrave
Attaching the full diff On Mon, Sep 07, 2020 at 01:09:12PM -0500, Jordan Hargrave wrote: > On Thu, Sep 03, 2020 at 08:37:56PM +0200, Mark Kettenis wrote: > > > Date: Wed, 2 Sep 2020 15:19:55 +1000 > > > From: Jonathan Gray > > > > > > On Tue, Sep 01, 20

Re: [PATCH] Add common PCIE capability list

2020-09-07 Thread Jordan Hargrave
On Thu, Sep 03, 2020 at 08:37:56PM +0200, Mark Kettenis wrote: > > Date: Wed, 2 Sep 2020 15:19:55 +1000 > > From: Jonathan Gray > > > > On Tue, Sep 01, 2020 at 11:44:03PM -0500, Jordan Hargrave wrote: > > > This patch adds a common function for scanning PC

Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-09-03 Thread Jordan Hargrave
On Thu, Sep 03, 2020 at 09:06:59PM +0200, Mark Kettenis wrote: > > Date: Tue, 1 Sep 2020 17:20:19 -0500 > > From: Jordan Hargrave > > > > [PATCH] Add IOMMU support for Intel VT-d and AMD Vi > > > > This hooks each pci device and overrides bus_dmamap_xxx t

Re: [PATCH] Add common PCIE capability list

2020-09-02 Thread Jordan Hargrave
On Wed, Sep 02, 2020 at 03:19:55PM +1000, Jonathan Gray wrote: > On Tue, Sep 01, 2020 at 11:44:03PM -0500, Jordan Hargrave wrote: > > This patch adds a common function for scanning PCIE Express Capability list > > The PCIE Capability list starts at 0x100 in extended PCI configura

Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-09-01 Thread Jordan Hargrave
Oh good catch thanks. Weird, it does compile! From: Daniel Dickman Sent: Tuesday, September 1, 2020 11:23 PM To: Jordan Hargrave Cc: tech@openbsd.org Subject: Re: [PATCH] Add IOMMU support for Intel VT-d and AMD-Vi > [PATCH] Add IOMMU support for Intel V

[PATCH] Add common PCIE capability list

2020-09-01 Thread Jordan Hargrave
This patch adds a common function for scanning PCIE Express Capability list The PCIE Capability list starts at 0x100 in extended PCI configuration space. --- sys/dev/pci/pci.c| 28 sys/dev/pci/pcivar.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/sys/d

[PATCH] Add IOMMU support for Intel VT-d and AMD-Vi

2020-09-01 Thread Jordan Hargrave
ull +++ b/sys/dev/acpi/acpidmar.c @@ -0,0 +1,2988 @@ +/* + * Copyright (c) 2015 Jordan Hargrave + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies.

PATCH: Add support for 64-bit MMIO to VMM

2020-08-21 Thread Jordan Hargrave
This patch is part of the PCI Passthrough VMM changes. This adds support for registering 64-bit MMIO regions and properly handles calculating BAR size for variable-lenth MMIO/IO regions. Verification via pcidump -v --- usr.sbin/vmd/pci.c | 69 +- 1 fi

[PATCH] Add helper vm_find_vcpu function for VMM

2020-08-18 Thread Jordan Hargrave
--- sys/arch/amd64/amd64/vmm.c | 63 -- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 84fcb23a5..f6d51737e 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@

PATCH: VMD fixes for PCI Config Space and BAR Allocation [passthrough PCI support]

2020-08-18 Thread Jordan Hargrave
This is the first patch for adding PCI passthrough support to VMD. I am splitting up the necessary changes into smaller patches. This code fixes the pci device union for accessing PCI config space >= 0x40 pcidump -xxx would return garbage data due to union overlap pci_add_bar now requires speci

[PATCH 2] Add support for Passthrough PCI to VMM

2020-08-11 Thread Jordan Hargrave
This patch adds support to VMM to support passthrough PCI. I have tested this on both Intel/AMD boxes, it requires the DMAR/IOMMU diff patch. It has worked so far with re0 network devices and azalia sound but would like more eyes and testing on this as well. In order to build this you need to cop

Re: [PATCHv2]: VT-D DMA support for PCI devices

2015-08-11 Thread Jordan Hargrave
a/sys/dev/acpi/acpidmar.c b/sys/dev/acpi/acpidmar.c new file mode 100755 index 000..29baf46 --- /dev/null +++ b/sys/dev/acpi/acpidmar.c @@ -0,0 +1,1943 @@ +/* + * Copyright (c) 2015 Jordan Hargrave + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or w

[PATCH]: VT-D DMA support for PCI devices

2015-07-23 Thread Jordan Hargrave
acpidmar.c diff -N dev/acpi/acpidmar.c --- /dev/null 1 Jan 1970 00:00:00 - +++ dev/acpi/acpidmar.c 22 Jul 2015 20:25:36 - @@ -0,0 +1,1872 @@ +/* + * Copyright (c) 2015 Jordan Hargrave + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or withou

Re: aml: Fix integer types to be unsigned

2012-04-01 Thread Jordan Hargrave
you will need to fix AMLOP_ONES as well. It does a (char)opcode typecast, which would be 0xff not 0x... if using uint64. amlop_match, amlop_wait, amlop_acquire, amlop_condref all will need to return AML_ONES or AML_TRUE > Date: Sun, 1 Apr 2012 10:45:55 +0300 > From: p...@irofti.net > To: o...

Re: aml: Fix integer types to be unsigned

2012-03-31 Thread Jordan Hargrave
Strings are always called with -1 (to pull the size-field from strlen itself) for creation. So technically that could be any large constant as well. > To: o...@drijf.net > CC: tech@openbsd.org; kette...@openbsd.org; chas...@skynet.be; jor...@openbsd.org > Subject: Re: aml: Fix integer types to be

ACPI patch: Fix CondRef target

2011-06-01 Thread Jordan Hargrave
This patch fixes CondRef store to empty target seen on Dell E4310 and some HP systems. Please test and send dmesg output. Index: dsdt.c === RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v retrieving revision 1.185 diff -u -p -b -r1.185 dsdt

PATCH: ACPI aml dereference diff

2011-04-22 Thread Jordan Hargrave
This diff creates a common aml_dereference function, please test on as many systems as possible and send dmesg Index: acpiprt.c === RCS file: /cvs/src/sys/dev/acpi/acpiprt.c,v retrieving revision 1.43 diff -u -p -b -r1.43 acpiprt.c -

PATCH: Fix boolean value for ACPI logical comparisons

2011-03-18 Thread Jordan Hargrave
This patch changes the values of boolean comparisons from 0:1 to 0:-1 (from ACPI Spec) in order to fix an AML issue on some Asus machines. Please test on other machines as well to verify that hardware sensors/acpi/boot work properly. Index: dsdt.c

Re: New acpi challenges! New Dell XPS blows up in acpivideo!

2011-01-09 Thread Jordan Hargrave
It looks like there is a new L06 bios for the L401X, can you try this? > Date: Wed, 22 Dec 2010 16:08:54 -0500 > From: kwesterb...@rogers.com > To: tech@openbsd.org > CC: jor...@openbsd.org; mlar...@openbsd.org; ma...@openbsd.org; kette...@openbsd.org > Subject: New acpi challenges! New Dell XPS b

Re: New acpi challenges! New Dell XPS blows up in acpivideo!

2010-12-22 Thread Jordan Hargrave
Bad AML. Looks like it is trying to do an AML Load of a memory block, and that is failing. Usually that's because the checksum is incorrect. Look at dsdt.c:aml_load() and put printf's at both goto fails', to see what is failing. Not much I can do about it now as I am in Palau. :) -jordan > Date

ACPI: (redux) Early acpiec initialization diff

2010-07-23 Thread Jordan Hargrave
Redux: this new version will apply with -current This patch will allow acpiec to initialize earlier if a ECDT table is found. This fixes a lockup if booting on some Thinkpads while docked. You can tell if your system supports ECDT by scanning the ACPI tables line in dmesg. There should be a li

ACPI: Early acpiec initialization diff

2010-07-23 Thread Jordan Hargrave
This patch will allow acpiec to initialize earlier if a ECDT table is found. This fixes a lockup if booting on some Thinkpads while docked. You can tell if your system supports ECDT by scanning the ACPI tables line in dmesg. There should be a line like this: acpi0: tables DSDT FACP SSDT ECDT TCP

Re: ACPI Name Search diff for Thinkpad, etc

2010-07-22 Thread Jordan Hargrave
If there's no delta in dmesg, then it's good. > Date: Thu, 22 Jul 2010 20:43:43 +0200 > From: dawed...@gmx.de > To: jor...@openbsd.org > Subject: Re: ACPI Name Search diff for Thinkpad, etc > > On Thu, 22 Jul 2010 11:10:27 -0600 (MDT) > Jordan Hargrave wrote: >

ACPI Name Search diff for Thinkpad, etc

2010-07-22 Thread Jordan Hargrave
This patch is needed on some Thinkpads when searching 'short' name paths (\_SB.PCI0. instead of \_SB_.PCI0.xxx) Please test and report. Index: dsdt.c === RCS file: /cvs/src/sys/dev/acpi/dsdt.c,v retrieving revision 1.172 diff -u

Test: ACPI PCI _PRT bus fix

2010-07-09 Thread Jordan Hargrave
This diff fixes a panic seen on Dell PEx9xx servers with the new ACPI PCI mapping. The _INI code was resetting the _ADR to 0x on some systems if the PCI bus does not exist. This caused the pci_make_tag to panic as dev/fn were 0x. The second change is in acpiprt.. a panic was put in

Re: [resend] Please test this ACPI panic check diff

2010-07-01 Thread Jordan Hargrave
.com > To: jor...@cvs.openbsd.org > CC: jhar...@gmail.com; tech@openbsd.org > > On Thu, Jul 1, 2010 at 2:53 PM, Jordan Hargrave wrote: >> Index: dev/acpi/acpi.c >> === >> RCS file: /cvs/src/sys/dev/acpi/a

[resend] Please test this ACPI panic check diff

2010-07-01 Thread Jordan Hargrave
penBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -42,6 +41,10 @@ #include #include +#include +#include +#i

ACPI panic check, please test

2010-07-01 Thread Jordan Hargrave
.169 2010/07/01 16:23:46 thib Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -42,6 +41,10 @@

Re: ACPI PCI mapping revert diff

2010-07-01 Thread jordan hargrave
uart Henderson wrote: > On 2010/07/01 03:37, Jordan Hargrave wrote: >> So found the problem; on the R210 the AML code CHANGES the _HID for >> the PCI Root Bus depending on the _OSI OS running.. UGH >> >> I'd had code in dsdt.c for ages that converted the _HID intege

ACPI PCI mapping revert diff

2010-07-01 Thread Jordan Hargrave
/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include +#include +#include +#include + #include #inc

ACPI PCI Mapping diff

2010-07-01 Thread Jordan Hargrave
06:56:15 - @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.168 2010/07/01 06:29:32 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.167 2010/07/01 01:39:39 jordan Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -18,6 +18,7 @@ #include #include +#include