From patchwork Tue Sep 10 14:49:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19921 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 736D2246A4 for ; Tue, 10 Sep 2013 14:49:51 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l4sf7791786yen.10 for ; Tue, 10 Sep 2013 07:49:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=vaI9/p7CLf+g1oWYUtqXguZhELiL+tyaPBq49/7H4vM=; b=lCpKQHPvq35M+O6OcuIAp2ATcPPONEaznZpOWZECG3zxfCu++hYooz9hdwlf5K9uvP L/keujB4OjNRJrACQLz9zeExOm+jUjWZb4Hcd6j2cIW4dJ6aXZwLq2AdvKbCiEQsMuYM NsYv1EeYoPmKzWJ797MMzEl8eQZf+b9uIWitnXRzm9uWseQtleoKbGBmZ6uH97gPxYpP JagsXImbe/2IXjVE7HnatzSlteA04raAj1BpHUAt1aVfTIDkcIrX0F+FWj4g0gPB/xGw m3QpHKzVQR8g+7t1F2+mvE559e+Lb14XFJ3K/HH3+bE9ncnk0zoBbX+fo2DJPM/K8tVZ 3QQg== X-Received: by 10.236.90.67 with SMTP id d43mr8464377yhf.36.1378824591260; Tue, 10 Sep 2013 07:49:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.82 with SMTP id b18ls2339622qen.53.gmail; Tue, 10 Sep 2013 07:49:51 -0700 (PDT) X-Received: by 10.58.67.9 with SMTP id j9mr1872140vet.22.1378824591022; Tue, 10 Sep 2013 07:49:51 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id gw1si4531140vcb.62.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so4754367veb.12 for ; Tue, 10 Sep 2013 07:49:51 -0700 (PDT) X-Gm-Message-State: ALoCoQnes2a3a+kWL71ufRL0YzTWm/8jY67suzN8Iz+KCbR/8zWyhpif4E7fH9+YJcrLCHSXzbUf X-Received: by 10.58.196.132 with SMTP id im4mr1128816vec.28.1378824590910; Tue, 10 Sep 2013 07:49:50 -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 u4csp4672vcz; Tue, 10 Sep 2013 07:49:50 -0700 (PDT) X-Received: by 10.14.184.3 with SMTP id r3mr13389470eem.49.1378824588970; Tue, 10 Sep 2013 07:49:48 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id e49si15303340eep.201.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:48 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.49; Received: by mail-ee0-f49.google.com with SMTP id d41so3914901eek.22 for ; Tue, 10 Sep 2013 07:49:48 -0700 (PDT) X-Received: by 10.14.100.138 with SMTP id z10mr3259134eef.74.1378824588297; Tue, 10 Sep 2013 07:49:48 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id i1sm31911644eeg.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:47 -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 v3 19/27] xen/arm: Add new platform specific callback device_is_blacklist Date: Tue, 10 Sep 2013 15:49:07 +0100 Message-Id: <1378824555-16564-20-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> References: <1378824555-16564-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.128.181 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 75192af..8da71f2 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -655,7 +655,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 \