From patchwork Fri Sep 13 12:49:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20044 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B02FA28E9A for ; Fri, 13 Sep 2013 12:50:03 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ht10sf1166930vcb.5 for ; Fri, 13 Sep 2013 05:50:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=88gWKmaUsA5YFNiv+B1uwRw4NvFxwPcEwoNcQRyFoxE=; b=Y1kgZGIqZsKvc2BvF/vmDqt1E+/D/Ceh97VnCP3Jule3bgiwVkhE2+W7RQqVK9yXvb RP8CC//77q/UVPBcwG0Hx6D5mu0Qe4RabzuZ3x5xSLjE1mD4PcU5ke/Wck3GVifVBkP0 z6FOc7ZNOlSYSeFgwMilO7lTl1pXoUOSwDyUUHAThMw7y5d97jIxEkk+sxSRB/DWdPGT bdRFi1SUhxkJSwjEtdSTA/QxguLNSeDKNP5ilfzXQDuo2bhImi54selt3ueQXO1EhgI3 OFGkC5uVEVOl4BXM+TGYztvvCDud4U7N7tembNwvF8lNde5SZ5TXq777BM+kAQuoeF8x vkaw== X-Gm-Message-State: ALoCoQmj7ypS507Kagi21PdeDq7/mdlBpygMqv3ieVMtc4NGEESqVR65pwt025wLOgVcZn9K0xVk X-Received: by 10.236.54.68 with SMTP id h44mr4934433yhc.21.1379076603182; Fri, 13 Sep 2013 05:50:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.99.10 with SMTP id em10ls1103129qeb.82.gmail; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) X-Received: by 10.220.164.202 with SMTP id f10mr1546767vcy.25.1379076602937; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id zw10si3082372vdb.31.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id gf12so863891vcb.22 for ; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) X-Received: by 10.58.198.13 with SMTP id iy13mr11877437vec.11.1379076602832; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp78791vcz; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) X-Received: by 10.14.127.70 with SMTP id c46mr2818692eei.58.1379076601372; Fri, 13 Sep 2013 05:50:01 -0700 (PDT) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by mx.google.com with ESMTPS id 47si3782347eea.61.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.171; Received: by mail-ea0-f171.google.com with SMTP id n15so555201ead.2 for ; Fri, 13 Sep 2013 05:50:00 -0700 (PDT) X-Received: by 10.14.199.3 with SMTP id w3mr18079822een.33.1379076600569; Fri, 13 Sep 2013 05:50:00 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id p5sm14678420eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH v4 19/27] xen/arm: Add new platform specific callback device_is_blacklist Date: Fri, 13 Sep 2013 13:49:26 +0100 Message-Id: <1379076574-28316-20-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> References: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Each platform code will list the device that must not pass-through to a guest. Theses devices are used for: power management, timer,... When theses devices are given to DOM0, it can controls the hardware and then break the whole platform. This callback is enough until we will start to care about power performance. For this purpose, we may need to extend this interface to implement per-device MMIO filtering to allow dom0 to continue to control devices which it owns which happen to share e.g. a clock controller with Xen. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v3: - Rename platform_device_is_blacklist to platform_device_is_blacklisted Changes in v2: - Update commit message --- xen/arch/arm/domain_build.c | 3 ++- xen/arch/arm/platform.c | 10 ++++++++++ xen/include/asm-arm/platform.h | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index cda1e13..300a64d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -676,7 +676,8 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, DPRINT("handle %s\n", path); /* Skip theses nodes and the sub-nodes */ - if ( dt_match_node(skip_matches, np ) ) + if ( dt_match_node(skip_matches, np ) || + platform_device_is_blacklisted(np) ) { DPRINT(" Skip it!\n"); return 0; diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c index afda302..db79368 100644 --- a/xen/arch/arm/platform.c +++ b/xen/arch/arm/platform.c @@ -127,6 +127,16 @@ bool_t platform_has_quirk(uint32_t quirk) return !!(quirks & quirk); } +bool_t platform_device_is_blacklisted(const struct dt_device_node *node) +{ + const struct dt_device_match *blacklist = NULL; + + if ( platform && platform->blacklist_dev ) + blacklist = platform->blacklist_dev; + + return dt_match_node(blacklist, node); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h index f460e9c..a19dbf7 100644 --- a/xen/include/asm-arm/platform.h +++ b/xen/include/asm-arm/platform.h @@ -4,6 +4,7 @@ #include #include #include +#include /* Describe specific operation for a board */ struct platform_desc { @@ -26,6 +27,11 @@ struct platform_desc { * board with different quirk on each */ uint32_t (*quirks)(void); + /* + * Platform blacklist devices + * List of devices which must not pass-through to a guest + */ + const struct dt_device_match *blacklist_dev; }; /* @@ -40,6 +46,7 @@ int __init platform_specific_mapping(struct domain *d); void platform_reset(void); void platform_poweroff(void); bool_t platform_has_quirk(uint32_t quirk); +bool_t platform_device_is_blacklisted(const struct dt_device_node *node); #define PLATFORM_START(_name, _namestr) \ static const struct platform_desc __plat_desc_##_name __used \