From patchwork Tue Nov 2 11:07:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516685 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4444897iml; Tue, 2 Nov 2021 05:03:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzg8xVNt8yJ1x9fbxBptdD5+M/AGKAqwlUPyMShWswSD2Fu0kMcl5p7aYgBwKQvDD/suoy X-Received: by 2002:a05:6808:10d2:: with SMTP id s18mr4735395ois.30.1635854598384; Tue, 02 Nov 2021 05:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635854598; cv=none; d=google.com; s=arc-20160816; b=vHgO4xNeACBC9jyY+4vHZ01Q6M048FXgSiMu76CLYldVXP+oOLgxjbCkIuMLBuSk6s WDrjMJohZrII9xgzNORtZu0mbCDFRxWvSePt1Yrc3KvkxwKEBGDitcU5CbNJuz0DuJ8w t3tRowWWnTJwobBxBRugCg+dt+DbbERt7V3dTzeERpIOqlNnp/S9L5XnFKUSInurbm9G zUoItaiBPMBT+Z4XZ3wT7HYBx7ihKHhFbuI13rFl9qUi2qcyRYA2BkFX2l3o6K/i4EjI /EItUGuA+C5L+wUtDr5dYwsgZ+pwclZAWMg1F5tFQUTXNx7MOAGDZj31y3YrzDTzGkG2 zY+A== 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=MIsR5ntgtAsaxoJ+NtIU7qk3vK65x7GB6eb5bSAQ4NA=; b=lCTbsxlK7TvjqwsNoVph5fsWJy9GUr/gWfdvjunUEr496ahJN0d15daMC2HJ66pxB5 fb//Ai+b2dgolh9pJJONdwIeKB92XGccffTq0iMoHXa/zIHqa6570fg85hX/Ir7uZ5Cm +hJ5O4pK4wNTEGn19xrPaXL98DRGDb2NZENMaIjNo8VqWMCNPZpPFg9/e9aYJcZ8ssa+ uo8waWS4jh0WG5ZtErkenKd7GFp6VlPOE/p1FABzuCdOK7Uri5lmOJ1GZeOPF31GeKcc lxaTWNxRzr9fBj+XG3Xb+VBBND5xRmBXPANdlUMduxD8SPcI18kMqcc+QxFhiD+N2sNa j1Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=idtZ3bpW; 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=fail (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 bc11si22857653oob.27.2021.11.02.05.03.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 05:03:18 -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=fail header.i=@linaro.org header.s=google header.b=idtZ3bpW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhsVZ-0006n1-OO for patch@linaro.org; Tue, 02 Nov 2021 08:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhrhI-0001gG-Jk for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:11:20 -0400 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:43691) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhrhF-00021W-5q for qemu-devel@nongnu.org; Tue, 02 Nov 2021 07:11:18 -0400 Received: by mail-qt1-x82e.google.com with SMTP id 8so986711qty.10 for ; Tue, 02 Nov 2021 04:11:16 -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=MIsR5ntgtAsaxoJ+NtIU7qk3vK65x7GB6eb5bSAQ4NA=; b=idtZ3bpWwOwDhGsa6Tp4Y07D2p7fu5keQIByYmeHsYQ8rjwyhhu8eCDyEzMdlMOGo3 AO5RQ7cCTvAYgtB9iXFu5FbuxH5Gm6CdVt9mcj2fyVV+ceXk3ybqz3KSZWpwm+VEo5wt n4zO+bhbQ8M+ZnNQp3JFJWLUDX3JXJJii0tI54VP7/CavHVo01rKimcJgrIBzEjbUgYZ RGhnP7CKdBql5goDmvXk04ddw6BZeXUHzpyEKzRBQ4o2SHdezuM5Pf+PCXoqN+OxfNag 0u1eU53lVwVKwlueWRmc3bLPZilHi93/comh1uz6bmNBGE8Rq+YT+7BhktMFdrclb7nI amCg== 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=MIsR5ntgtAsaxoJ+NtIU7qk3vK65x7GB6eb5bSAQ4NA=; b=DI1Ga0z7wuendmfiSSv5KgJa74eM0XaTxJ/HtyCIt2oZMZeRhku/3DLEQtTXUCh2xg dpWDok0DFei141YdrOksJUpSUNtB3vz+He3JTGaLEtZ8iEagSzZfLkavLNefS0FfkiFi dv3lpV3c+8lPKRNrrE1VrcU6I9DuifLED9vKZdbWskLJFkmp3degbDiFB8zwreJ4wYuF o/5CrPqNDfAA8yD8gE1Ufgg0j3sb6KElrLiq96C8RDEDWkq4OgY5nXgBwgZlSb2PkmIe E2Gbj+VsmdVMsPs5dMXgw2mdU28R/8kqGokGkWqGmymk3vhYCQtMqfuxoQurjnUcuVBU 4W8Q== X-Gm-Message-State: AOAM5335mVuYMXZzuvCPeKrGcZPEIHNX4A67ELXpcF8LaQKGpUfLKGqL Ax7IhsYwnXQ80rE7G+KH3sSao7t9y6x4FQ== X-Received: by 2002:ac8:5e49:: with SMTP id i9mr36082947qtx.145.1635851476337; Tue, 02 Nov 2021 04:11:16 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id bm25sm12730854qkb.4.2021.11.02.04.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 04:11:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 58/60] accel/tcg: Report unaligned load/store for user-only Date: Tue, 2 Nov 2021 07:07:38 -0400 Message-Id: <20211102110740.215699-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102110740.215699-1-richard.henderson@linaro.org> References: <20211102110740.215699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82e.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 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 , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= , Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new cpu_loop_exit_sigbus for cpu_mmu_lookup. Reviewed-by: Warner Losh Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 1ee64f01fc..aaf47d89d2 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -218,9 +218,14 @@ static void validate_memop(MemOpIdx oi, MemOp expected) static void *cpu_mmu_lookup(CPUArchState *env, target_ulong addr, MemOpIdx oi, uintptr_t ra, MMUAccessType type) { + MemOp mop = get_memop(oi); + int a_bits = get_alignment_bits(mop); void *ret; - /* TODO: Enforce guest required alignment. */ + /* Enforce guest required alignment. */ + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_loop_exit_sigbus(env_cpu(env), addr, type, ra); + } ret = g2h(env_cpu(env), addr); set_helper_retaddr(ra);