From patchwork Mon Nov 9 11:32:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brazdil X-Patchwork-Id: 11891269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92306C2D0A3 for ; Mon, 9 Nov 2020 11:38:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FDCF20731 for ; Mon, 9 Nov 2020 11:38:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e8o76mGN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="sB/y2/Ui" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FDCF20731 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J154s5vUbvtLxn9TvDzIKdQc8QS6ftj4Y4q7RndldXM=; b=e8o76mGNmfiA6Uv8pyUnIvXAB jWR0xNYqL5zIfU1xM5M7h3B1kLp+PnI+L6+IbCaiJFWeRtPNCwLT+V5+WzpjMQomB46wswz8AEAlJ c988+plfr7cnEQWEefycVSvWLf3x3p/tmEogRIotn31KYCvbk3n+EW1iDM0GED7aQKe5eqs3MsYut 4reRCrcFjhIpf5E55+MDTxHhlAjhgnMMlAkxuie8LpXfiIrIcZi/O19MSdRJHAe/hBNKFAbhUi2uJ oODCh25qoQtPbY9nUgmJ/44A42S/14poDgM9gkRrCOix7I3JE2p+cpUUw7H5OfgFsoE+6EPQLTWgT 8BZ++Gx/g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5UB-0006OK-Cg; Mon, 09 Nov 2020 11:37:23 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5QB-0004WR-SS for linux-arm-kernel@lists.infradead.org; Mon, 09 Nov 2020 11:33:29 +0000 Received: by mail-wm1-x343.google.com with SMTP id p19so5264506wmg.0 for ; Mon, 09 Nov 2020 03:33:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=caV1ipuiTawe8T6twZGVAfyUFvhkg9VCzsqdE5ZajF4=; b=sB/y2/Ui9hncBiir49+ICz2IN5o2gtyOCZwiJX/81JcCULdYTBnLUZyWbf6WVQntem ST3A4s2jm+XkTBO+sD3RVmCmxXbkleOYtQkWctTReDQDMpcUTd8lFfELThVx7bxsi3A+ mvOkZQv7hxbi/TUEOZtp4ETbpxrbZrLYmIaYwxS6p4xqY1hdKrvJTKfq6C6+XLdCQYb8 NUY4JS033hx/waCf51nR8AnhxJWjo9FCRMh00+hUa0kh/PrtaUg6VfqLa2Hr8xyE3Dpf +lBqYkLg5uQySHjRhpyROYvpOV29xnCuLkDENvnYQ4A2kG6ODvE3+I00D69G0vZ7YC1K 5odw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=caV1ipuiTawe8T6twZGVAfyUFvhkg9VCzsqdE5ZajF4=; b=DRX32k9La4FZJyLQ7Mq59mJbrVxgxyi8a5sf7JHGBvIVr9/OEfs2IBgLKVa0CXr1MT JGskyXuSkTg5za8yY8/9u09m1N3QLFrV6QtieQN85AlBJUHWNP1N9TrhtoU51RicjQb+ n9REE5FSeTLca8BMtWqIqumHjElQTCSQLbh9V9nWbBl5bQ5MxmQV4TxaKAMi6RzHp1yz gXU8MImyO0k2uRCC8CAPpH61BrVEmJIxXvU1Blb/RFjcxac9CcFIo2mhqwGtyfTa437I NGXxOXlL1+6uG/aC/H6wzjiZVqrBD6yV9rKhY9R/6fVoMUly/AGAbfGY7lBtovWpHzIF NMZA== X-Gm-Message-State: AOAM530yL5F14Mf2mXsEM8coFs3uBLtBSFnkNZ0A/+HNi2W1qwhyea1+ plK7gVbFJeJiCy1p8ulnQ2GgmQ== X-Google-Smtp-Source: ABdhPJzSRWUlAySru4rwQabNSKivoN+hTeZrlzLIDmklGE7PxHdfZql7hj+Mrx0wU/sAZLmtXqsBrw== X-Received: by 2002:a7b:cd99:: with SMTP id y25mr13827347wmj.128.1604921594515; Mon, 09 Nov 2020 03:33:14 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id n128sm5063590wmb.46.2020.11.09.03.33.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:33:13 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v1 17/24] kvm: arm64: Add __hyp_pa_symbol helper macro Date: Mon, 9 Nov 2020 11:32:26 +0000 Message-Id: <20201109113233.9012-18-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_063316_197930_404C90B5 X-CRM114-Status: GOOD ( 14.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Marc Zyngier , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Tejun Heo , Dennis Zhou , Christoph Lameter , David Brazdil , Will Deacon , Julien Thierry , Andrew Scull Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add helper macro for computing the PA of a kernel symbol in nVHE hyp code. This will be useful for computing the PA of a PSCI CPU_ON entry point. Signed-off-by: David Brazdil --- arch/arm64/kvm/hyp/nvhe/psci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/psci.c b/arch/arm64/kvm/hyp/nvhe/psci.c index b0b5df590ba5..7510b9e174e9 100644 --- a/arch/arm64/kvm/hyp/nvhe/psci.c +++ b/arch/arm64/kvm/hyp/nvhe/psci.c @@ -20,6 +20,16 @@ s64 hyp_physvirt_offset; #define __hyp_pa(x) ((phys_addr_t)((x)) + hyp_physvirt_offset) +#define __hyp_pa_symbol(sym) \ + ({ \ + extern char sym[]; \ + unsigned long kern_va; \ + \ + asm volatile("ldr %0, =%1" : "=r" (kern_va) \ + : "S" (sym)); \ + kern_va - kimage_voffset; \ + }) + static u64 get_psci_func_id(struct kvm_cpu_context *host_ctxt) { return host_ctxt->regs.regs[0];