From patchwork Wed Feb 4 14:02:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44370 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 47A192029F for ; Wed, 4 Feb 2015 14:07:43 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf1473932wgh.1 for ; Wed, 04 Feb 2015 06:07:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=bkLzkpNno7OF/gYeKtYT0n5oQGzxiGOeCNd/zV0LHg8=; b=gyLGOXq/hkUrJ/DhLPQgPBmE5Q7fX15s7vwwRiJd1LrNqafXD2wJQix46Td7b9eMXR RtxuNbHqG81Gvnhrk70Fh8Ido1Mz+nMmwqiCTGZSDmwV+ICT7gYqG2xKeddQdUHNVQer eS3o+NgBNmJ2w9ZLFL48Ed0fQq73EFwfcMZGT5CYnvFMzK8qj8RTCSujIRaOWI11+h3t AxXNMqxoZEU6sJyf9N6JtAFvcMSNjcBhx6wtruEmtWtqPxjYnMQMbO10nuYoCC3RNgMx km4opNz24099fI5rWMgSjdjP7eRRJvX1rQ7ioWbI0LmQ5bR4+Aea656/S7WWqMIg+UB5 YY9A== X-Gm-Message-State: ALoCoQnXihQt0/t1OW+LYh0ev2VAMnM9Un3k6w/ujdGQebnLdbkChn/Xd28hcSxhRruxL1bKWpkl X-Received: by 10.180.88.199 with SMTP id bi7mr371950wib.1.1423058862494; Wed, 04 Feb 2015 06:07:42 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.99 with SMTP id w3ls44053laz.2.gmail; Wed, 04 Feb 2015 06:07:42 -0800 (PST) X-Received: by 10.152.23.73 with SMTP id k9mr31014804laf.54.1423058862275; Wed, 04 Feb 2015 06:07:42 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id po1si1411561lbb.87.2015.02.04.06.07.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:07:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so1710039lab.6 for ; Wed, 04 Feb 2015 06:07:42 -0800 (PST) X-Received: by 10.112.164.101 with SMTP id yp5mr30131433lbb.82.1423058862132; Wed, 04 Feb 2015 06:07:42 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp508600lbj; Wed, 4 Feb 2015 06:07:40 -0800 (PST) X-Received: by 10.170.60.138 with SMTP id c132mr14081876ykc.66.1423058860209; Wed, 04 Feb 2015 06:07:40 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id hd10si2174261qcb.6.2015.02.04.06.07.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:07:40 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0bU-0001hc-OL; Wed, 04 Feb 2015 14:06:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0bS-0001bZ-Jm for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:06:50 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 03/4D-03219-97722D45; Wed, 04 Feb 2015 14:06:49 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-15.tower-31.messagelabs.com!1423058807!11866616!1 X-Originating-IP: [209.85.192.179] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22186 invoked from network); 4 Feb 2015 14:06:48 -0000 Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by server-15.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:06:48 -0000 Received: by pdbft15 with SMTP id ft15so888324pdb.5 for ; Wed, 04 Feb 2015 06:06:47 -0800 (PST) X-Received: by 10.68.69.69 with SMTP id c5mr47019638pbu.90.1423058807123; Wed, 04 Feb 2015 06:06:47 -0800 (PST) Received: from parthd-ubunutu.qualcomm.com ([202.46.23.62]) by mx.google.com with ESMTPSA id kg12sm2161881pbb.44.2015.02.04.06.06.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:06:44 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:18 +0530 Message-Id: <1423058539-26403-35-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Cc: ian.campbell@citrix.com, julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, Parth Dixit , christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 34/35] arm : acpi workarounds for firmware/linux dependencies X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Parth Dixit Some bugs are identified in edk2 and some of the functionality is not yet merged. This patch contains workarounds for them Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 82 ++++++++++++++++++++++++++++++++++++++++++++- xen/arch/arm/vgic.c | 16 +++++++++ xen/drivers/acpi/osl.c | 7 ++-- 3 files changed, 102 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index a504064..a425ef4 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1234,7 +1234,87 @@ static int make_chosen_node(const struct domain *d, const struct kernel_info *ki return res; } +#define ACPI_UEFI_MEM_STUB + +#ifdef ACPI_UEFI_MEM_STUB +enum{ + IO_NET0, + IO_SREG, + IO_VIRT, + IO_SCT0, + IO_AAC0, + IO_MMC0, + IO_KMI0, + IO_KMI1, + IO_SER1, + IO_SER2, + IO_SER3, + IO_WDT0, + IO_TIM0, + IO_TIM2, + IO_RTC0, + IO_TIM3, + IO_TIM4, + IO_MAX +}; +#define INIT_IO( dev,addr,size ) [dev] = {addr,size} + +static const u64 acpi_mmio_region[][IO_MAX]= + { + INIT_IO(IO_NET0,0x1a000000,(PAGE_SIZE*16) ), + INIT_IO(IO_SREG,0x1c010000,PAGE_SIZE), + INIT_IO(IO_VIRT,0x1c130000,PAGE_SIZE), + INIT_IO(IO_SCT0,0x1c020000,PAGE_SIZE), + INIT_IO(IO_AAC0,0x1c040000,PAGE_SIZE), + INIT_IO(IO_MMC0,0x1c050000,PAGE_SIZE), + INIT_IO(IO_KMI0,0x1c060000,PAGE_SIZE), + INIT_IO(IO_KMI1,0x1c070000,PAGE_SIZE), + INIT_IO(IO_SER1,0x1c0a0000,PAGE_SIZE), + INIT_IO(IO_SER2,0x1c0b0000,PAGE_SIZE), + INIT_IO(IO_SER3,0x1c0c0000,PAGE_SIZE), + INIT_IO(IO_WDT0,0x1c0f0000,PAGE_SIZE), + INIT_IO(IO_TIM0,0x1c110000,PAGE_SIZE), + INIT_IO(IO_TIM2,0x1c120000,PAGE_SIZE), + INIT_IO(IO_RTC0,0x1c170000,PAGE_SIZE), + INIT_IO(IO_TIM3,0x2a810000,(PAGE_SIZE*16) ), + INIT_IO(IO_TIM4,0x2a830000,(PAGE_SIZE*16) ), + }; + +int acpi_map_mmio(struct domain *d) +{ + int i,res; + u64 addr,size; + + for (i = 0; i < IO_MAX; i++) + { + addr = acpi_mmio_region[i][0]; + size = acpi_mmio_region[i][1]; + res = iomem_permit_access(d, paddr_to_pfn(addr & PAGE_MASK), + paddr_to_pfn(PAGE_ALIGN(addr + size - 1))); + res = map_mmio_regions(d, + paddr_to_pfn(addr & PAGE_MASK), + DIV_ROUND_UP(size, PAGE_SIZE), + paddr_to_pfn(addr & PAGE_MASK)); + + + } +#if 0 + for( i=32 ; i < 255 ; i++ ) + { + res = vgic_reserve_virq(d, i); + res = route_irq_to_guest(d, i, NULL); + if ( res ) + { + printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n", + i, d->domain_id); + } + + } +#endif + return 0; +} +#else static int acpi_map_mmio(struct domain *d) { int i,res; @@ -1273,7 +1353,7 @@ static int acpi_map_mmio(struct domain *d) return 0; } - +#endif static int map_acpi_regions(struct domain *d) { int res; diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 97061ce..e74555d 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -254,6 +254,8 @@ void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n) } } +#define VGIC_ICFG_MASK(intr) ( 1 << ( ( 2 * ( intr % 16 ) ) + 1 ) ) + void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) { struct domain *d = v->domain; @@ -266,6 +268,20 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) while ( (i = find_next_bit(&mask, 32, i)) < 32 ) { irq = i + (32 * n); +#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI) + if( ( n!=0 ) && is_hardware_domain(d) ){ + struct vgic_irq_rank *vr = vgic_get_rank(v, n); + uint32_t tr; + tr = vr->icfg[i >> 4] ; + + if( ( tr & VGIC_ICFG_MASK(i) ) ) + acpi_set_irq(irq, DT_IRQ_TYPE_EDGE_BOTH); + else + acpi_set_irq(irq, DT_IRQ_TYPE_LEVEL_MASK); + + route_irq_to_guest(d,irq,NULL); + } +#endif v_target = d->arch.vgic.handler->get_target_vcpu(v, irq); p = irq_to_pending(v_target, irq); set_bit(GIC_IRQ_GUEST_ENABLED, &p->status); diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 73da9d9..2d78ba0 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -66,7 +66,7 @@ void __init acpi_os_vprintf(const char *fmt, va_list args) acpi_physical_address __init acpi_os_get_root_pointer(void) { - if (efi_enabled) { + if (efi_enabled) { if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) return efi.acpi20; else if (efi.acpi != EFI_INVALID_TABLE_ADDR) @@ -198,8 +198,11 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) return AE_OK; } - +#ifdef CONFIG_X86 #define is_xmalloc_memory(ptr) ((unsigned long)(ptr) & (PAGE_SIZE - 1)) +#else +#define is_xmalloc_memory(ptr) 1 +#endif void *__init acpi_os_alloc_memory(size_t sz) {