x86 page_fault not succeeding when mapping write-only

2020-11-16 Thread James Sewart
Hey, I’m looking into an issue after remapping some memory on 4.19, but looking at the code this may also be an issue in master. I have a driver that grabs some pages using alloc_pages, these pages are then remapped to userspace using calls to vm_insert_page inside a syfs bin_attribute mmap

Re: [PATCH v2 0/7] iommu/vt-d: Fix-up device-domain relationship by refactoring to use iommu group default domain.

2019-03-22 Thread James Sewart
Hey Lu, > On 20 Mar 2019, at 01:26, Lu Baolu wrote: > > Hi James, > > On 3/19/19 9:35 PM, James Sewart wrote: >> Hey Lu, >>> On 15 Mar 2019, at 03:13, Lu Baolu wrote: >>> >>> Hi James, >>> >>> On 3/14/19 7:56 PM, James

Re: [PATCH 3/4] iommu/vt-d: Allow IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY to be allocated

2019-03-09 Thread James Sewart
Hey Dmitry, > On 8 Mar 2019, at 01:20, Dmitry Safonov wrote: > > On 3/4/19 3:46 PM, James Sewart wrote: >> +static inline int domain_is_initialised(struct dmar_domain *domain) >> +{ >> +return domain->flags & DOMAIN_FLAG_INITIALISED; >> +} >

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-09 Thread James Sewart
Hey Lu, > On 9 Mar 2019, at 01:53, Lu Baolu wrote: > > Hi James, > > On 3/9/19 12:57 AM, James Sewart wrote: >> Hey Lu, >>> On 8 Mar 2019, at 03:09, Lu Baolu wrote: >>>>> >>>>> Do you mind if I work on top of your patches fo

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-08 Thread James Sewart
Hey Lu, > On 8 Mar 2019, at 03:09, Lu Baolu wrote: > > Hi James, > > On 3/7/19 6:21 PM, James Sewart wrote: >> Hey Lu, >>> On 7 Mar 2019, at 06:31, Lu Baolu wrote: >>> >>> Hi James, >>> >>> On 3/7/19 2:08 AM, James

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-07 Thread James Sewart
Hey Lu, > On 7 Mar 2019, at 06:31, Lu Baolu wrote: > > Hi James, > > On 3/7/19 2:08 AM, James Sewart wrote: >>>>>> -/* >>>>>> - * For each rmrr >>>>>> - * for each dev attached to rmrr >>>

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-06 Thread James Sewart
Hey, > On 6 Mar 2019, at 07:00, Lu Baolu wrote: > > Hi, > > On 3/5/19 7:46 PM, James Sewart wrote: >> Hey Lu, >>> On 5 Mar 2019, at 06:59, Lu Baolu wrote: >>> >>> Hi, >>> >>> It's hard for me to understand why do we remove

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-05 Thread James Sewart
anyway. > > More comments inline. > > On 3/4/19 11:47 PM, James Sewart wrote: >> The generic IOMMU code will allocate and attach a dma ops domain to each >> device that comes online, replacing any lazy allocated domain. Removes >> RMRR application at iommu init ti

Re: [PATCH 3/4] iommu/vt-d: Allow IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY to be allocated

2019-03-05 Thread James Sewart
Hey Lu, > On 5 Mar 2019, at 06:46, Lu Baolu wrote: > > Hi, > > On 3/4/19 11:46 PM, James Sewart wrote: >> Allowing IOMMU_DOMAIN_DMA type IOMMU domain to be allocated allows the >> default_domain of an iommu_group to be set. This delegates device-domain >> r

Re: [PATCH 0/4] iommu/vt-d: Fix-up device-domain relationship by refactoring to use iommu group default domain.

2019-03-05 Thread James Sewart
within its group, these regions could be remapped for the other devices resulting in unexpected behaviour during peer-to-peer transfers. Cheers, James > On 5 Mar 2019, at 06:05, Lu Baolu wrote: > > Hi James, > > Very glad to see this. Thank you! > > On 3/4/19 11:41 PM,

[PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-04 Thread James Sewart
create_direct_mappings. Signed-off-by: James Sewart --- drivers/iommu/intel-iommu.c | 202 ++-- 1 file changed, 8 insertions(+), 194 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 71cd6bbfec05..282257e2628d 100644 --- a/drivers/iommu

[PATCH 3/4] iommu/vt-d: Allow IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY to be allocated

2019-03-04 Thread James Sewart
Allowing IOMMU_DOMAIN_DMA type IOMMU domain to be allocated allows the default_domain of an iommu_group to be set. This delegates device-domain relationships to the generic IOMMU code. Signed-off-by: James Sewart --- drivers/iommu/intel-iommu.c | 113 +++- 1 file

[PATCH 2/4] iommu/vt-d: Implement apply_resv_region for reserving IOVA ranges

2019-03-04 Thread James Sewart
Used by iommu.c before creating identity mappings for reserved ranges to ensure dma-map-ops won't ever remap these addresses. Signed-off-by: James Sewart --- drivers/iommu/intel-iommu.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers

[PATCH 1/4] iommu: Move iommu_group_create_direct_mappings to after device_attach

2019-03-04 Thread James Sewart
If an IOMMU driver requires to know which IOMMU a domain is associated to initialise a domain then it will do so in device_attach, before which it is not safe to call iommu_ops. Signed-off-by: James Sewart --- drivers/iommu/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH 0/4] iommu/vt-d: Fix-up device-domain relationship by refactoring to use iommu group default domain.

2019-03-04 Thread James Sewart
the lazy allocation logic would not be used as any domain allocated using these paths would be replaced when attaching the group default domain. Default domain allocation has been tested with and without this patch on 4.19. Cheers, James. James Sewart (4): iommu: Move

Re: [RFC v2] iommu/vt-d: Allow iommu_domain_alloc to allocate IOMMU_DOMAIN_DMA

2019-01-15 Thread James Sewart
Hey Jacob, > On 7 Jan 2019, at 20:04, Jacob Pan wrote: > > On Wed, 5 Dec 2018 17:19:35 +0000 > James Sewart wrote: > >> Hey, >> >> There exists an issue in the logic used to determine domain >> association with devices. Currently the driver uses

Re: [RFC v2] iommu/vt-d: Allow iommu_domain_alloc to allocate IOMMU_DOMAIN_DMA

2019-01-02 Thread James Sewart
Bump > On 5 Dec 2018, at 17:19, James Sewart wrote: > > Hey, > > There exists an issue in the logic used to determine domain association > with devices. Currently the driver uses find_or_alloc_domain to either > reuse an existing domain or allocate a new one if one