From patchwork Sun Oct 24 23:58:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Posen X-Patchwork-Id: 1545469 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HlzGCgBK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HcwCb5PgKz9s0r for ; Mon, 25 Oct 2021 11:03:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2976783508; Mon, 25 Oct 2021 02:03:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HlzGCgBK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BE0AF83460; Mon, 25 Oct 2021 01:58:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5738282EBB for ; Mon, 25 Oct 2021 01:58:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jim.posen@gmail.com Received: by mail-qv1-xf2f.google.com with SMTP id v2so6117166qve.11 for ; Sun, 24 Oct 2021 16:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=loqFszjUn4v8H/dr2Ab6VPc3ug5KCn69Te/bkRWumT8=; b=HlzGCgBKSiMuwiN/Hg0Uom+jTmE67rnFJ8nXQjRl9kTiO75HrX+UKM/AYf5BKJreXa ZfnZLTKA23ckrouEtIatvBHunChmOWmS9u1gfah+2xopZ1W4ApPd0LJhoGOlbQzkBDjg jVXl+WAiU8o2KHr6W3NJ+G/njwqPO0lokGFZ+z/dBz9Mko30ROF9E5SB6u4vHWEyHH6O MCRnn/b2gAzGdCzrGoxzz5ovFwDPCjUv0tj+DshcGkRlJh5ZLqPem6dO2svsbohizjVT NpLmFBFG0ZGiD//a6661LzFQcE/QW/Z7m13BxACqcT1uqU4n7ZWwKjn/8JAyU+IQ7LBi 6Mxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=loqFszjUn4v8H/dr2Ab6VPc3ug5KCn69Te/bkRWumT8=; b=yBUCfV724qnlTJCWjok/xAlq5zrQ6LEwL8NWeR+uE9IGbtVOmi6fr40n1nYvXFRFDI RJ+GrgCFRSDhFHEQjC90xM8AzKTrIQ3Vo4MSxJ2HTiBRlWngkS/OLAbS0KyX69eehxYH S6F6wZa/HKVr/vdOPRN3kX7lElUXn6lW0b5H3JXHTMqUGfcVrKy3cky1937F1Ka9/huk It35uPHN1CXMW3+Sfv24teS1NnamTJnXOiJJ31wE603Qzn5efPQYTQm7DtjXL6+syh+6 b4rMEeqwe6xwlL6GFc1NG/bUhuRKZLCwIfLcPyInbc8YRTaYM/vqNplJfz7kvg2USFxu fvhw== X-Gm-Message-State: AOAM532ymuwHtkiJ7JoXiU83S6BQx9RR6rU0UaArHyYsXJhsxlcia1Ff jWH8Yi1cipGT4udlbEMLvA4lRtfh7q4= X-Google-Smtp-Source: ABdhPJxPu8Yl2SVqo/YfqS6lHxwNaN36Na/XqFS5AABvDAPXZrZyNGgTHhfyICuXd2T686JHpHojmA== X-Received: by 2002:ad4:568e:: with SMTP id bc14mr9337888qvb.67.1635119903905; Sun, 24 Oct 2021 16:58:23 -0700 (PDT) Received: from phantom.myfiosgateway.com ([68.237.40.64]) by smtp.gmail.com with ESMTPSA id c9sm6848573qte.43.2021.10.24.16.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Oct 2021 16:58:23 -0700 (PDT) From: Jim Posen To: u-boot@lists.denx.de Cc: trini@konsulko.com, mbrugger@suse.com, Jim Posen , Chia-Wei Wang Subject: [RFC PATCH 3/5] Set HVBAR register correctly Date: Sun, 24 Oct 2021 19:58:06 -0400 Message-Id: <20211024235808.1926508-4-jim.posen@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211024235808.1926508-1-jim.posen@gmail.com> References: <20211024235808.1926508-1-jim.posen@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 25 Oct 2021 02:02:55 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This is the base address register for the vector table when in hypervisor mode. Signed-off-by: Jim Posen --- arch/arm/cpu/armv7/start.S | 5 +++++ arch/arm/lib/relocate.S | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 698e15b8e1..bce8ddb1b0 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -113,6 +113,11 @@ switch_to_hypervisor_ret: ldr r0, =_start mcr p15, 0, r0, c12, c0, 0 @Set VBAR #endif +#ifdef CPU_V7_HAS_VIRT + /* Set vector address in CP15 VBAR register */ + ldr r0, =hyp_vector_table + mcr p15, 0, r0, c12, c0, 0 @Set HVBAR +#endif #endif /* the mask ROM code should have PLL and others stable */ diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S index 14b7f61c1a..3ebf6a519e 100644 --- a/arch/arm/lib/relocate.S +++ b/arch/arm/lib/relocate.S @@ -60,6 +60,14 @@ ENTRY(relocate_vectors) ldmia r0!, {r2-r8,r10} stmia r1!, {r2-r8,r10} #endif +#ifdef CONFIG_CPU_V7_HAS_VIRT + /* + * If the ARM processor has the virtualization extensions, + * use HVBAR to relocate the EL2 exception vectors. + */ + ldr r0, =hyp_vector_table /* load dynamically relocated address */ + mcr p15, 4, r0, c12, c0, 0 /* Set HVBAR */ +#endif #endif bx lr