From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC PATCH 14/19] xen/arm: vits: Map ITS translation space Date: Tue, 03 Mar 2015 17:41:00 +0000 Message-ID: <54F5F22C.3060401@linaro.org> References: <1425299435-3278-1-git-send-email-vijay.kilari@gmail.com> <1425299435-3278-15-git-send-email-vijay.kilari@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , vijay.kilari@gmail.com Cc: Ian.Campbell@citrix.com, Prasun.Kapoor@caviumnetworks.com, Vijaya Kumar K , tim@xen.org, xen-devel@lists.xen.org, stefano.stabellini@citrix.com, manish.jaggi@caviumnetworks.com List-Id: xen-devel@lists.xenproject.org On 03/03/15 17:31, Stefano Stabellini wrote: > On Mon, 2 Mar 2015, vijay.kilari@gmail.com wrote: >> From: Vijaya Kumar K >> >> ITS translation space contains GITS_TRANSLATOR >> register which is written by device to raise >> LPI. This space needs to mapped to every domain >> address space so that device can access GITS_TRANSLATOR >> register using SMMU >> >> Signed-off-by: Vijaya Kumar K >> --- >> xen/arch/arm/vgic-v3-its.c | 33 +++++++++++++++++++++++++++++++-- >> 1 file changed, 31 insertions(+), 2 deletions(-) >> >> diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c >> index 48c880a..e7e587e 100644 >> --- a/xen/arch/arm/vgic-v3-its.c >> +++ b/xen/arch/arm/vgic-v3-its.c >> @@ -1504,7 +1504,35 @@ static const struct mmio_handler_ops vgic_gits_mmio_handler = { >> .write_handler = vgic_v3_gits_mmio_write, >> }; >> >> -int vgic_its_domain_init(struct domain *d) >> +/* >> + * Map the 64K ITS translation space in guest. >> + * This is required purely for device smmu writes. >> + */ >> + >> +static int vgic_map_translation_space(struct domain *d) >> +{ >> + u64 addr, size; >> + int ret; >> + addr = d->arch.vits->phys_base + SZ_64K; >> + size = SZ_64K; >> + >> + ret = map_mmio_regions(d, >> + paddr_to_pfn(addr & PAGE_MASK), >> + DIV_ROUND_UP(size, PAGE_SIZE), >> + paddr_to_pfn(addr & PAGE_MASK)); >> + >> + if ( ret ) >> + { >> + printk(XENLOG_ERR "Unable to map to dom%d access to" >> + " 0x%"PRIx64" - 0x%"PRIx64"\n", >> + d->domain_id, >> + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1); >> + } >> + >> + return ret; >> +} > > Although we might want to map it 1:1 anyway, I think that this function > should be able to cope with a virtual GITS_TRANSLATOR address different > from the physical translator address. FWIW, a 1:1 mapping won't work for guest. Regards, -- Julien Grall