From patchwork Wed Feb 4 14:01:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44345 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 26C272029F for ; Wed, 4 Feb 2015 14:05:11 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf2477556wiv.2 for ; Wed, 04 Feb 2015 06:05:10 -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=cA1yUE8awJ95wKoZ3k1HeEFVsIFqMWM76AsE36VF/Mw=; b=dzKreCgRPAXuwEU4bRtK019/KR02rThIKDO7QWyK/OcazZ5Szb2OgPHcvorSw4Akzz rCymT35vxGUvNENaBQCbTTWMgZxK7qmzbyiOHzoPp+8zFNm0owBmZYbVhghXpadHjcyC F0YbiO76WUH3Z/S/BvaHO9ydJhLtufav5A13yhBAEHY4I/wlYEfVrAZQELertfL31wbD E4BRvxy3sIAeV6DHow1HysvQYDNEQkFKLNMlHz1ol6oXIF9W5hM3pDJWRla50Jpl0CDa VIOoVPnj/JqrfeSkaFm2E7xfGhzvKTqhuC3H4aR7JXPVxQNH67QGY96EzY7dLuDHreAq WKlA== X-Gm-Message-State: ALoCoQlLkcsSlagORgJM2bxvDsL0gGQv5JV5ct+lA2uaZDotmdcT/WlWqnUZPBkofU9FFNQLhtT4 X-Received: by 10.194.239.41 with SMTP id vp9mr880851wjc.5.1423058710401; Wed, 04 Feb 2015 06:05:10 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.105 with SMTP id r9ls40598lar.8.gmail; Wed, 04 Feb 2015 06:05:10 -0800 (PST) X-Received: by 10.112.144.164 with SMTP id sn4mr25264670lbb.2.1423058710243; Wed, 04 Feb 2015 06:05:10 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id q4si1391535lag.103.2015.02.04.06.05.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:05:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so1615048lbj.11 for ; Wed, 04 Feb 2015 06:05:10 -0800 (PST) X-Received: by 10.152.219.37 with SMTP id pl5mr26469459lac.6.1423058710108; Wed, 04 Feb 2015 06:05:10 -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 h5csp506782lbj; Wed, 4 Feb 2015 06:05:08 -0800 (PST) X-Received: by 10.52.26.110 with SMTP id k14mr16239849vdg.65.1423058703209; Wed, 04 Feb 2015 06:05:03 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id hs9si734137vdb.41.2015.02.04.06.05.02 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:05:03 -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 1YJ0Xy-0006PX-9y; Wed, 04 Feb 2015 14:03:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0Xw-0006P2-Ja for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:03:12 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id D4/BC-02999-F9622D45; Wed, 04 Feb 2015 14:03:11 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1423058589!11951525!1 X-Originating-IP: [209.85.192.172] 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 19115 invoked from network); 4 Feb 2015 14:03:10 -0000 Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:03:10 -0000 Received: by pdbfp1 with SMTP id fp1so869614pdb.2 for ; Wed, 04 Feb 2015 06:03:09 -0800 (PST) X-Received: by 10.68.253.101 with SMTP id zz5mr46419693pbc.50.1423058588995; Wed, 04 Feb 2015 06:03:08 -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.03.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:03:07 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:31:46 +0530 Message-Id: <1423058539-26403-3-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, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 02/35] xen: arm64: ACPI: Support common ACPI drivers 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.217.180 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: Naresh Bhat xen hypervisor will use ACPI for initialisation in the same manner that current x86/x86_64 ones do. Add the calls to initialise the ACPI tables and load devices using the xen/drivers/acpi subsytem. Signed-off-by: Naresh Bhat --- xen/common/sysctl.c | 2 + xen/drivers/acpi/osl.c | 6 ++ xen/drivers/acpi/utilities/utglobal.c | 1 + xen/include/asm-arm/acpi.h | 106 ++++++++++++++++++++++++++++++++++ xen/include/asm-arm/arm64/page.h | 2 + 5 files changed, 117 insertions(+) create mode 100644 xen/include/asm-arm/acpi.h diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 0cb6ee1..a700a16 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -170,6 +170,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) op->u.availheap.avail_bytes <<= PAGE_SHIFT; break; +#ifdef CONFIG_X86 #ifdef HAS_ACPI case XEN_SYSCTL_get_pmstat: ret = do_get_pm_info(&op->u.get_pmstat); @@ -181,6 +182,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) copyback = 1; break; #endif +#endif case XEN_SYSCTL_page_offline_op: { diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 93c983c..73da9d9 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -96,7 +96,11 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size) return __va(phys); return __vmap(&pfn, PFN_UP(offs + size), 1, 1, PAGE_HYPERVISOR_NOCACHE) + offs; } +#ifdef CONFIG_X86 return __acpi_map_table(phys, size); +#else + return __va(phys); +#endif } void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) @@ -105,6 +109,7 @@ void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) vunmap((void *)((unsigned long)virt & PAGE_MASK)); } +#ifdef CONFIG_X86 acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) { u32 dummy; @@ -140,6 +145,7 @@ acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) return AE_OK; } +#endif acpi_status acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) diff --git a/xen/drivers/acpi/utilities/utglobal.c b/xen/drivers/acpi/utilities/utglobal.c index 7dbc964..65c918e 100644 --- a/xen/drivers/acpi/utilities/utglobal.c +++ b/xen/drivers/acpi/utilities/utglobal.c @@ -43,6 +43,7 @@ #define DEFINE_ACPI_GLOBALS +#include #include #include #include diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h new file mode 100644 index 0000000..f6284b5 --- /dev/null +++ b/xen/include/asm-arm/acpi.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2014, Naresh Bhat + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#ifndef _ASM_ARM64_ACPI_H +#define _ASM_ARM64_ACPI_H + +#include + +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long + +#define MAX_LOCAL_APIC 256 +#define MAX_IO_APICS 64 + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* Asm macros */ +#define ACPI_ASM_MACROS +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() local_irq_disable() +#define ACPI_ENABLE_IRQS() local_irq_enable() +#define ACPI_FLUSH_CPU_CACHE() flush_cache_all() + +/* Blob handling macros */ +#define ACPI_BLOB_HEADER_SIZE 8 + +/* Basic configuration for ACPI */ +#ifdef CONFIG_ACPI +extern int acpi_disabled; +extern int acpi_noirq; +extern int acpi_pci_disabled; +extern int acpi_strict; + +/* map logic cpu id to physical APIC id + * APIC = GIC cpu interface on ARM + */ +extern volatile int arm_cpu_to_apicid[NR_CPUS]; +extern int boot_cpu_apic_id; +#define cpu_physical_id(cpu) arm_cpu_to_apicid[cpu] + +struct acpi_arm_root { + paddr_t phys_address; + unsigned long size; +}; +extern struct acpi_arm_root acpi_arm_rsdp_info; + +void arm_acpi_reserve_memory(void); + +/* Low-level suspend routine. */ +extern int (*acpi_suspend_lowlevel)(void); + +extern void prefill_possible_map(void); + +#define acpi_wakeup_address (0) + +static inline void disable_acpi(void) +{ + acpi_disabled = 1; + acpi_pci_disabled = 1; + acpi_noirq = 1; +} +static inline void acpi_noirq_set(void) { acpi_noirq = 1; } +static inline void acpi_disable_pci(void) +{ + acpi_pci_disabled = 1; + acpi_noirq_set(); +} + +#else /* !CONFIG_ACPI */ +#define acpi_disabled 1 /* ACPI sometimes enabled on ARM */ +#define acpi_noirq 1 /* ACPI sometimes enabled on ARM */ +#define acpi_pci_disabled 1 /* ACPI PCI sometimes enabled on ARM */ +#define acpi_strict 1 /* no ACPI spec workarounds on ARM */ +#endif + +#endif /*_ASM_ARM_ACPI_H*/ diff --git a/xen/include/asm-arm/arm64/page.h b/xen/include/asm-arm/arm64/page.h index 1fd416d..13b0ea1 100644 --- a/xen/include/asm-arm/arm64/page.h +++ b/xen/include/asm-arm/arm64/page.h @@ -1,6 +1,8 @@ #ifndef __ARM_ARM64_PAGE_H__ #define __ARM_ARM64_PAGE_H__ +#include + #ifndef __ASSEMBLY__ /* Write a pagetable entry */