From patchwork Tue Nov 17 09:40:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 483EABF90C for ; Tue, 17 Nov 2015 10:19:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57D93204E0 for ; Tue, 17 Nov 2015 10:19:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 581B6203C0 for ; Tue, 17 Nov 2015 10:19:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZydKM-0004aU-UY; Tue, 17 Nov 2015 10:17:31 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zycpf-0000b8-Ds for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:45:55 +0000 Received: by wmec201 with SMTP id c201so218003118wme.0 for ; Tue, 17 Nov 2015 01:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mDapFFYDVcSd5UYcCFc6gtywiKtgyc+VwIkCz4r0nUA=; b=0uQAVDe6sNHZeLH+CU1RCJTrHJ0brblfydnGf3x3P+D/pHVXaufjfnyG9Z/kBwrh43 Qhpm+lbYn/9WdmEeSZ4GXhZF/TG4l0532sBp/lemt8EoelYm+wjDrPH7hHPmbEUgxUpg jZUX//ACibT3vzR6gjDRs/rpG44KHlw2chgBhubnmlZLhn1GK6Lpi47Zov5fztkGJ0LE 88IhPY7C+YfhHjxwMU78PUWLe1FOfyagS5lGz9VJ2kodwK2XdsEy+QE/c4ra0RwfND/m ZczaN9WlNylk9ttJ+SVNQCg8nWzRtRs2yc+k3TMqii9mP9T3PgIxWkt5VfnCgTMsORYM peQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mDapFFYDVcSd5UYcCFc6gtywiKtgyc+VwIkCz4r0nUA=; b=ORHD7kP9bENDhv3COoiG3G4yc5lcnamm3oVe/U6LYmnl4NUb7ZPmWkgNSCAwIwcV3X 8vmkDS47Xbz2xwm4mRDO4vXRkboHLS+bRTECLL8sFHHVWQFfMt1z+Enhr/koLP5yhwke gd2TOgA0WO3RhQg6fQD/w6iqT338RG1WNCmtPnLMsE3fMDVA5f8pWeqlj0VSON9NL64A kQBclVS4n389TgFCjk0K1/MaSMfZQY2tBYT9axyudV2ttDOu8LVDcAcGKqAu9o9C9xyn /frcep9ZMrqtRmQwnCQTKehYIZmTpB7FN8OhWT5GQZXiHxD/AjDh+vdwNvHiwymbG3OJ iRag== X-Gm-Message-State: ALoCoQk2AVH54sCa+FjOY2qg9Ozi+EuksJwyWDcfx4DCpGRueyZh+ozmKcmA07l3wJ4WX3rVaOep X-Received: by 10.194.57.178 with SMTP id j18mr22511306wjq.113.1447753526062; Tue, 17 Nov 2015 01:45:26 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id m64sm22998591wmf.14.2015.11.17.01.45.23 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:45:25 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Subject: [PATCH v3 29/62] arm/acpi: Add GTDT support updated by ACPI 5.1 Date: Tue, 17 Nov 2015 17:40:28 +0800 Message-Id: <1447753261-7552-30-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014548_394781_E3494017 X-CRM114-Status: GOOD ( 12.89 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parth Dixit With ACPI 5.0, we got per-processor timer support in GTDT, and ACPI 5.1 introduced the support for platform (memory-mapped) timers: GT Block and SBSA watchdog timer, add the code needed for the spec change. Signed-off-by: Hanjun Guo Signed-off-by: Naresh Bhat Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Acked-by: Stefano Stabellini --- xen/include/acpi/actbl3.h | 98 +++++++++++++++++++++++++++++++++++++++------- xen/include/asm-arm/acpi.h | 2 + 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/xen/include/acpi/actbl3.h b/xen/include/acpi/actbl3.h index 8c61b5f..fc96963 100644 --- a/xen/include/acpi/actbl3.h +++ b/xen/include/acpi/actbl3.h @@ -241,33 +241,101 @@ struct acpi_s3pt_suspend { /******************************************************************************* * - * GTDT - Generic Timer Description Table (ACPI 5.0) - * Version 1 + * GTDT - Generic Timer Description Table (ACPI 5.1) + * Version 2 * ******************************************************************************/ struct acpi_table_gtdt { struct acpi_table_header header; /* Common ACPI table header */ - u64 address; - u32 flags; - u32 secure_pl1_interrupt; - u32 secure_pl1_flags; - u32 non_secure_pl1_interrupt; - u32 non_secure_pl1_flags; + u64 counter_block_addresss; + u32 reserved; + u32 secure_el1_interrupt; + u32 secure_el1_flags; + u32 non_secure_el1_interrupt; + u32 non_secure_el1_flags; u32 virtual_timer_interrupt; u32 virtual_timer_flags; - u32 non_secure_pl2_interrupt; - u32 non_secure_pl2_flags; + u32 non_secure_el2_interrupt; + u32 non_secure_el2_flags; + u64 counter_read_block_address; + u32 platform_timer_count; + u32 platform_timer_offset; }; -/* Values for Flags field above */ +/* Flag Definitions: Timer Block Physical Timers and Virtual timers */ + +#define ACPI_GTDT_INTERRUPT_MODE (1) +#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1) +#define ACPI_GTDT_ALWAYS_ON (1<<2) + +/* Common GTDT subtable header */ + +struct acpi_gtdt_header { + u8 type; + u16 length; +}; + +/* Values for GTDT subtable type above */ + +enum acpi_gtdt_type { + ACPI_GTDT_TYPE_TIMER_BLOCK = 0, + ACPI_GTDT_TYPE_WATCHDOG = 1, + ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + +/* GTDT Subtables, correspond to Type in struct acpi_gtdt_header */ -#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 +/* 0: Generic Timer Block */ + +struct acpi_gtdt_timer_block { + struct acpi_gtdt_header header; + u8 reserved; + u64 block_address; + u32 timer_count; + u32 timer_offset; +}; + +/* Timer Sub-Structure, one per timer */ + +struct acpi_gtdt_timer_entry { + u8 frame_number; + u8 reserved[3]; + u64 base_address; + u64 el0_base_address; + u32 timer_interrupt; + u32 timer_flags; + u32 virtual_timer_interrupt; + u32 virtual_timer_flags; + u32 common_flags; +}; + +/* Flag Definitions: timer_flags and virtual_timer_flags above */ + +#define ACPI_GTDT_GT_IRQ_MODE (1) +#define ACPI_GTDT_GT_IRQ_POLARITY (1<<1) + +/* Flag Definitions: common_flags above */ + +#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) +#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) + +/* 1: SBSA Generic Watchdog Structure */ + +struct acpi_gtdt_watchdog { + struct acpi_gtdt_header header; + u8 reserved; + u64 refresh_frame_address; + u64 control_frame_address; + u32 timer_interrupt; + u32 timer_flags; +}; -/* Values for all "TimerFlags" fields above */ +/* Flag Definitions: timer_flags above */ -#define ACPI_GTDT_INTERRUPT_MODE 1 -#define ACPI_GTDT_INTERRUPT_POLARITY 2 +#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1) +#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1) +#define ACPI_GTDT_WATCHDOG_SECURE (1<<2) /******************************************************************************* * diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h index 1efa29d..714e596 100644 --- a/xen/include/asm-arm/acpi.h +++ b/xen/include/asm-arm/acpi.h @@ -46,4 +46,6 @@ static inline void disable_acpi(void) acpi_disabled = 1; } +#define ACPI_GTDT_INTR_MASK ( ACPI_GTDT_INTERRUPT_MODE | ACPI_GTDT_INTERRUPT_POLARITY ) + #endif /*_ASM_ARM_ACPI_H*/