From patchwork Wed Nov 24 19:39:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Posen X-Patchwork-Id: 1559282 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=HgVTA5Cy; 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 4Hzrvp32Z0z9sR4 for ; Thu, 25 Nov 2021 06:40:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D10BD82D7E; Wed, 24 Nov 2021 20:40:26 +0100 (CET) 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="HgVTA5Cy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 282B78069C; Wed, 24 Nov 2021 20:40:25 +0100 (CET) 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (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 7C25F80735 for ; Wed, 24 Nov 2021 20:40:21 +0100 (CET) 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-qk1-x730.google.com with SMTP id a11so4093462qkh.13 for ; Wed, 24 Nov 2021 11:40:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kV/DbYQHiER57O8WSbvmvGLTR49uFAoILgxXyH1lPqU=; b=HgVTA5CyGT2eFCAPsgFUPWhCeDsEaZE5HE9SqLd5Ju3EC2u2PQtw6wN4SE0fhgxM+X E0A0id+0CWmE0ognv2H2JPz4C9Bkl45j+H6hALWNEZ5uh2PBysTfDaD63kjTAY1pXXWT J3z3BzN107kmQmXkpoyRjxntrc1A2S8cYcq3m7DlJMbaFztRCzRjIhynTuFwxRdFpVOx s3bL3Hen/VFvGLM5ArUQpCtLBD55ulwODj88+hJszU2moutcV11LphEX8VciagIEfimu fVN4eK7KvkqBb99SMNH7YNs5zBH++xzyUhyQPfmsiv2z7XrQQswfu3FVZwYVqTQEcQmF gXew== 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:mime-version :content-transfer-encoding; bh=kV/DbYQHiER57O8WSbvmvGLTR49uFAoILgxXyH1lPqU=; b=GG83jobGYO+xzlmTeoCDK4Kadw0qwx4NaXWZVGQcot/N1bMdd9o2GxOYiVbQOVn9Wl eBzD5A8l2z1mFOvIBBV6qSPOPV9iCb3fPjXBm70w8Xc2gG9f4AU596MLcsBrikoBOIf+ trexVu67zN3GYKpIyMIQd2prOYxw5VscDMRblqkioKcb5w6owrMbDxrIJz7aK165Xd5G /jX8pHhoiAchr8Poyxw6w5R0TZuJh2rlPkq/t+TQ8JtMPXZ0baN8WP7csca6aJvM7PBw RpWOxS1yxThkgnhkpsin0x6/dukcZUmXs9sBRnbvQPRrljyhpx4O6g7jSQIDmjU3vrd9 Jd8Q== X-Gm-Message-State: AOAM530YcPkEUCYMJ0jgOBGPB9EfK9IeGd4YU8Aq3ADZoPwnB5zdNxFY CE3cvso/kizWl1NFveqLR1kMp5Gy9nQ= X-Google-Smtp-Source: ABdhPJy8aqGx+ztAs7JbeXDJymBTsbEQT8AzRJrpxsvDT3mEOie9VhDI95Z+ELLUer91SR2rRheMVg== X-Received: by 2002:a05:620a:d84:: with SMTP id q4mr874865qkl.610.1637782819731; Wed, 24 Nov 2021 11:40:19 -0800 (PST) Received: from localhost.localdomain (cpe-68-175-35-150.nyc.res.rr.com. [68.175.35.150]) by smtp.gmail.com with ESMTPSA id o1sm395201qtw.1.2021.11.24.11.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 11:40:19 -0800 (PST) From: Jim Posen To: u-boot@lists.denx.de Cc: trini@konsulko.com, mbrugger@suse.com, Jim Posen , Chia-Wei Wang , Harald Seiler , Minkyu Kang , Simon Glass , Sughosh Ganu Subject: [PATCH v2 0/6] Exception handling in HYP mode on ARMv7-A Date: Wed, 24 Nov 2021 14:39:55 -0500 Message-Id: <20211124194001.443232-1-jim.posen@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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 Currently, when U-Boot is running in hypervisor mode on ARMv7-A CPUs with virtualization extensions, the exception handling does not work. A couple things need to change which are detailed in my earlier message to the u-boot mailing list with the subject "Exception handling in HYP mode on ARMv7-A". I have verified that this patch series works on the ODroid XU4 and the Raspberry Pi 3B in Aarch32 mode when running in hypervisor mode. One simple way to verify is by running the miscellaneous "exception" command (CMD_EXCEPTION). This can be tested with QEMU now. Configure with qemu_arm_defconfig and add CMD_EXCEPTION and QEMU_ARM_32BIT_HAS_VIRT. Then run qemu-system-arm \ -machine virt,virtualization \ -nographic -serial mon:stdio \ -bios u-boot.bin U-Boot 2021.10-... ... => exception undefined Changes in v2: - Fix CP15 register written to in start.S - Check processor mode as HVBAR register is only accessible in HYP mode - Add QEMU config option for ARM32 with virtualization extensions Jim Posen (6): Compile for ARMv7-A with virtualization extensions Hypervisor mode interrupt vector table Set HVBAR register correctly Remove dead code Fix PC adjustment logic in exception handlers Config to target QEMU virt machine with virtualization arch/arm/Makefile | 4 + arch/arm/cpu/armv7/start.S | 8 ++ arch/arm/include/asm/u-boot-arm.h | 14 ++-- arch/arm/lib/interrupts.c | 26 +++--- arch/arm/lib/relocate.S | 13 +++ arch/arm/lib/vectors.S | 129 +++++++++++++++++++++++------- arch/arm/mach-bcm283x/Kconfig | 3 + arch/arm/mach-exynos/Kconfig | 1 + arch/arm/mach-qemu/Kconfig | 6 ++ 9 files changed, 153 insertions(+), 51 deletions(-)