From patchwork Fri Aug 16 21:05:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19269 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EA89425A1B for ; Fri, 16 Aug 2013 21:06:38 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id cd7sf1434996qab.9 for ; Fri, 16 Aug 2013 14:06:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; 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=LX23j2ZzXK4wreOVaNGZzIth/7UnL5OmoU5eSgOP6Ys=; b=eM2Vas+ZqqWh70/E5NIfDvx1DlzIlkxVeaRjbZ16Dy1CCnUsea4sJChUfFy/mSVitv +ujayVxlY2YNl7P/861WhlBwU0n53QVMYPX+jXBNTpsyqnBrDNoASWECBq7KyH2AEiOL ua/+9LI3aUVL3ADWylUV+9jIT1lWZNKTyfMsyu3xq6nqdpEak3q+Drh+9Aq7TGZc2U+g Qa0AVVrRpc0TrLxo/CEkPt3+JzebwHtRmQZSOxo/TNIKG9jKOS59pGgowM2HIlG+KWab z1baXr8CjW3TQudKgHBzOQf6f2RYgR2opZQphDVjNGrNMJkA4RsK7zMq6erZOf1wE1ft XVUg== X-Received: by 10.236.191.233 with SMTP id g69mr1082363yhn.54.1376687198689; Fri, 16 Aug 2013 14:06:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.27.195 with SMTP id v3ls962498qeg.6.gmail; Fri, 16 Aug 2013 14:06:38 -0700 (PDT) X-Received: by 10.221.6.195 with SMTP id ol3mr19347vcb.34.1376687198538; Fri, 16 Aug 2013 14:06:38 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id tf3si779870vec.68.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id cy12so1668178veb.4 for ; Fri, 16 Aug 2013 14:06:38 -0700 (PDT) X-Gm-Message-State: ALoCoQkaCHTWScMh9mCM/OqYbWw+Lb9BzC0zS0CKBcaF02+wUnez9e7cZPIO3j/gyEdlNLC0m2Ia X-Received: by 10.52.117.79 with SMTP id kc15mr14124vdb.45.1376687198449; Fri, 16 Aug 2013 14:06:38 -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 u4csp89466vcz; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) X-Received: by 10.180.39.212 with SMTP id r20mr643984wik.13.1376687197458; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by mx.google.com with ESMTPS id ez16si244719wic.21.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:37 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.53 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.53; Received: by mail-wg0-f53.google.com with SMTP id c11so1934159wgh.20 for ; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) X-Received: by 10.194.174.36 with SMTP id bp4mr2507668wjc.7.1376687197042; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id b13sm797327wic.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:36 -0700 (PDT) From: Julien Grall To: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com Cc: patches@linaro.org, andre.przywara@linaro.org, xen-devel@lists.xen.org, Julien Grall Subject: [RFC 20/24] xen/arm: Add new platform specific callback device_is_blacklist Date: Fri, 16 Aug 2013 22:05:52 +0100 Message-Id: <1376687156-6737-21-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> References: <1376687156-6737-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.173 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. Signed-off-by: Julien Grall --- xen/arch/arm/domain_build.c | 2 +- xen/arch/arm/platform.c | 10 ++++++++++ xen/include/asm-arm/platform.h | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d8d67a6..93f77c6 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -419,7 +419,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, DPRINT("handle %s\n", dt_node_full_name(np)); /* Skip theses nodes and the sub-nodes */ - if ( dt_match_node(skip_matches, np ) ) + if ( dt_match_node(skip_matches, np ) || platform_device_is_blacklist(np) ) return 0; if ( dt_device_used_by(np) != DOMID_XEN && diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c index afda302..cae0580 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_blacklist(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..4b511ed 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_blacklist(const struct dt_device_node *node); #define PLATFORM_START(_name, _namestr) \ static const struct platform_desc __plat_desc_##_name __used \