From patchwork Tue Apr 26 18:18:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 566120 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp3875024map; Tue, 26 Apr 2022 12:21:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyevyIqsGYObtctcQqFRlO8U3peQg/xMTTKOyOf+V9eknlJ8tpPTRaEw31fkjkYfQ0iZdU1 X-Received: by 2002:a25:1ec5:0:b0:641:1bf5:d4ba with SMTP id e188-20020a251ec5000000b006411bf5d4bamr22538666ybe.410.1651000861356; Tue, 26 Apr 2022 12:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651000861; cv=none; d=google.com; s=arc-20160816; b=pOHAeHkjWjF4lUfQcKrBuqF56z1G1Vc/mqh8+eI33SPiCwGYoJyic5gVsJ3cyGTlfZ eToBqtP5Nwwscjr3kXJFOBkcbPoVf7Kcbt64XX3Tkf32Nc0/woAC2vFbo1/lw5HUvMBq qiKSrtvHWlIeombG19J8Bn00wZuHRHjHFcdxN8sSY3yIlMV1pAOAE8kUACJm/EtrmY0k 84mIiKBFSKLSw0vrmYZbgb2mC0VYQ8jS7alQZZuwkeyAgOXSartCXM1UvVdUlxT4DHNx oB/NahCau3ohhubpAEDlfTGYHZTTHptHZVr+4d0XSW4F9zhzg2WOTKwk6XOPGh8u8y+z c9sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3qxaCTAb9LNwU3nym8tcsfcPLahPlRpIRpMaVcx2cxM=; b=qblqWu6Svak7GsmkidjF1123F4NckoXOhHlY/Kl5MJCC9gOe2VVMnknKXDEPa4psaJ x3r9/x8e5/ITUy1FmlatyyfOZhCWc9FEj/4zKEV3LbNuLCiGOZyEbek4zD3GIS8vrrSo Sp2AwksouFore/CzdOl3sh/GJyfKVToz+TW674+6jrsYpvvO+8F3jZcMSWCY9W/ugt/c WchZOMtzrqHJsuQ1ygZUNs42VlyXzuSA7xbWc/YrAOXPNzwuH+d3pF84CExhpc9Q3QQH FKlA2rvae4sTQVcQDAXRtK5jKj/lud2y9cww+yenRHyvvDcw0/mIgBP+4/nPNYwGWwG3 5DWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mvTchj3x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 194-20020a8112cb000000b002f83cbe56f3si156742yws.92.2022.04.26.12.21.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Apr 2022 12:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mvTchj3x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njQk7-0003SO-6W for patch@linaro.org; Tue, 26 Apr 2022 15:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njPpy-0001r3-NM for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:22:58 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:44746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njPpw-0005RF-Q1 for qemu-devel@nongnu.org; Tue, 26 Apr 2022 14:22:58 -0400 Received: by mail-pj1-x102e.google.com with SMTP id m14-20020a17090a34ce00b001d5fe250e23so3278247pjf.3 for ; Tue, 26 Apr 2022 11:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3qxaCTAb9LNwU3nym8tcsfcPLahPlRpIRpMaVcx2cxM=; b=mvTchj3xjtD8zks+a17nSiJv8fHUt6k4MMHS1RtrE+hdv1/lWozzan63FRKjDNHy/5 6/pDdTz2wxTPlzxq1ChefXsxqqBa02XH/a9iXw9FUN4lWRW0r2Nkux4kPJBZfq7EjFxx DbWCgvBocBphBzabg3lDDaV0cCRy6JoCTM/7BiiioIoGxxagLrrBDxzVOpTkTGsAfAE5 cJ/t8RPu52WUCHRTzgm6g96R7SCplMRVCCG0fIV+8NudtBOAbNVyYECeOhkuk2E54+hX lgf+BbJ3xzBIUolu9Hwb3Z9pVNhWtIwku+peqwYB/6RLxkSBuCrzEp7kVqmcrjccFTCy q8Yg== 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=3qxaCTAb9LNwU3nym8tcsfcPLahPlRpIRpMaVcx2cxM=; b=zBDULBwDSt5mrb8rdK1yAyKvSxov6imdhV8Jora2wC0alI7iJYI6QSJpARaNjTpK2B 9DuIhyMoZefIHU67rw7Sie3HUwQmQFCLfyV71DVWpna7rKPoWV1ZjMAOIIm4C+DFAeHy OMfqM4IHzzNt/Bl1cvTOH8cbwuX4bDGMBW9BlR8SAE1Qim9XXa+unLbunsbrqpHTgPJe zGIDpfhsBEuEXIpUX4rqhwgcRAR7UmX4IGQ1stG67y8ye24CyAYKe6/F4ggI8/ePVJMN K6XCP+P8PEgNV0htFmkU2Qg8uiybJ+iby2B3cweG2U3/oUvbkPSVM8Ikzs6Ivr2GRZgB 4xFA== X-Gm-Message-State: AOAM533zm7sCEOD+AujbId/KYynTXRehIPthpfueA0kqcxnfjsUlJ7F8 wfIoX9/Vxvp+ah5WBE+A4uwky2Obaq6efg== X-Received: by 2002:a17:902:da88:b0:15d:3dae:b0a4 with SMTP id j8-20020a170902da8800b0015d3daeb0a4mr3140853plx.75.1650997375560; Tue, 26 Apr 2022 11:22:55 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id k187-20020a636fc4000000b003983a01b896sm13585053pgc.90.2022.04.26.11.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 11:22:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 51/68] target/nios2: Enable unaligned traps for system mode Date: Tue, 26 Apr 2022 11:18:50 -0700 Message-Id: <20220426181907.103691-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220426181907.103691-1-richard.henderson@linaro.org> References: <20220426181907.103691-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Unaligned traps are optional, but required with an mmu. Turn them on always, because the fallback behaviour undefined. Enable alignment checks in the config file. Unwind the guest pc properly from do_unaligned_access. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-48-richard.henderson@linaro.org> --- configs/targets/nios2-softmmu.mak | 1 + target/nios2/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/targets/nios2-softmmu.mak b/configs/targets/nios2-softmmu.mak index 9a372f0717..1e93b54cd1 100644 --- a/configs/targets/nios2-softmmu.mak +++ b/configs/targets/nios2-softmmu.mak @@ -1 +1,2 @@ TARGET_ARCH=nios2 +TARGET_ALIGNED_ONLY=y diff --git a/target/nios2/helper.c b/target/nios2/helper.c index c5a2dd65b1..2e9fea4a01 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -241,8 +241,8 @@ void nios2_cpu_do_unaligned_access(CPUState *cs, vaddr addr, CPUNios2State *env = &cpu->env; env->ctrl[CR_BADADDR] = addr; - env->ctrl[CR_EXCEPTION] = FIELD_DP32(0, CR_EXCEPTION, CAUSE, EXCP_UNALIGN); - helper_raise_exception(env, EXCP_UNALIGN); + cs->exception_index = EXCP_UNALIGN; + cpu_loop_exit_restore(cs, retaddr); } bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,