From patchwork Wed Jul 22 16:48:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1334041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Y+96Sxxv; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBhXN1pkmz9sQt for ; Thu, 23 Jul 2020 02:59:48 +1000 (AEST) Received: from localhost ([::1]:51298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyI5p-0007RP-Uu for incoming@patchwork.ozlabs.org; Wed, 22 Jul 2020 12:59:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4h-0005u2-KI for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:35 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10279) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4f-0002fu-PA for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595437113; x=1626973113; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EEcXoQzOEpyedNq1KqU81uQZwfqgkAVodrjSDY+pIyA=; b=Y+96SxxvWmO10FRshdM0VYIqr8E5B72E4oK+wTiJiVk4lgm4tYhkAyvj gFK3DbQHXhseoX1NnT7PJBeqZWt5OqWhXH1foPdIx3vbXf5PxT1RsfEtr 8UIdUF9g2xdXMgwMw9adGYXmI5LPEfq/BRPzel+1mwhmgniCnVL7GRZkA DkA3Zk9FNX79Z30XX1Pl0ZCjThZRDBxL+AA7DEAw1+VBXxBe9xDMtwzAC OfYJbfpFiTOGO5hWD+sf8Emjc3DinR9Yvp9dEI/Og6teANgW7VuQkYjCo Gl8TbSlK7OK0elPhJaU31JembPPRRtBZ5DL+vjlVjKULNjN7qPVebtPln w==; IronPort-SDR: nukzmwo5bl2eRh0EzRmGIWcdZAk5OX+NMPg4lYVVnjdftqGD9qdrMPZbvlusdLVVYqjXf3dqlU rE/IyYY1kSgWJxEZrw6I++eNFbcD8upPoyuzwye60CNmQQU9Trlhw6o+DGPzP78QnpQWpIrkOW cH4CueLxmO+Ja2U4BwWjlYkenpeaXk8a/CrgsGSdTyXySRyhXyNpZ/T9zXrYdVsL0pjT+TSoQC oaqoYDVY275M/3FrLDLhAZYAKQn6Dqh+0ZtaONq+x2d9FFFPISCsFu2/2m2i69fD+ej5tPy1tU Pzk= X-IronPort-AV: E=Sophos;i="5.75,383,1589212800"; d="scan'208";a="252418633" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2020 00:58:21 +0800 IronPort-SDR: 33U8veotb/MG5fTjjbi0i6gpe0jprWR/4u4bBYwV468M+qsE870JqDYMF8B7DtqBG6JNvg6HOk e8EHaBvdNzQKRf/poYa5S9x2Eeu5ocmvM= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 09:46:38 -0700 IronPort-SDR: hVNb4kZzjpLeKmIF9LS2qp96/k78/zaJzEgIhs14gIyntrFmuEtepi0QNfLqBpmQY6OLmMG+mN So+AwVHXh/DA== WDCIronportException: Internal Received: from usa001575.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.58.115]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Jul 2020 09:58:21 -0700 From: Alistair Francis To: qemu-devel@nongnu.org Subject: [PULL 1/5] goldfish_rtc: Fix non-atomic read behaviour of TIME_LOW/TIME_HIGH Date: Wed, 22 Jul 2020 09:48:34 -0700 Message-Id: <20200722164838.1591305-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164838.1591305-1-alistair.francis@wdc.com> References: <20200722164838.1591305-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.141.245; envelope-from=prvs=465c3c755=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 12:58:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alistair Francis , Richard Henderson , Jessica Clarke Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jessica Clarke The specification says: 0x00 TIME_LOW R: Get current time, then return low-order 32-bits. 0x04 TIME_HIGH R: Return high 32-bits from previous TIME_LOW read. ... To read the value, the kernel must perform an IO_READ(TIME_LOW), which returns an unsigned 32-bit value, before an IO_READ(TIME_HIGH), which returns a signed 32-bit value, corresponding to the higher half of the full value. However, we were just returning the current time for both. If the guest is unlucky enough to read TIME_LOW and TIME_HIGH either side of an overflow of the lower half, it will see time be in the future, before jumping backwards on the next read, and Linux currently relies on the atomicity guaranteed by the spec so is affected by this. Fix this violation of the spec by caching the correct value for TIME_HIGH whenever TIME_LOW is read, and returning that value for any TIME_HIGH read. Signed-off-by: Jessica Clarke Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20200718004934.83174-1-jrtc27@jrtc27.com> Signed-off-by: Alistair Francis --- include/hw/rtc/goldfish_rtc.h | 1 + hw/rtc/goldfish_rtc.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/hw/rtc/goldfish_rtc.h b/include/hw/rtc/goldfish_rtc.h index 16f9f9e29d..9bd8924f5f 100644 --- a/include/hw/rtc/goldfish_rtc.h +++ b/include/hw/rtc/goldfish_rtc.h @@ -41,6 +41,7 @@ typedef struct GoldfishRTCState { uint32_t alarm_running; uint32_t irq_pending; uint32_t irq_enabled; + uint32_t time_high; } GoldfishRTCState; #endif diff --git a/hw/rtc/goldfish_rtc.c b/hw/rtc/goldfish_rtc.c index 01e9d2b083..6ddd45cce0 100644 --- a/hw/rtc/goldfish_rtc.c +++ b/hw/rtc/goldfish_rtc.c @@ -94,12 +94,22 @@ static uint64_t goldfish_rtc_read(void *opaque, hwaddr offset, GoldfishRTCState *s = opaque; uint64_t r = 0; + /* + * From the documentation linked at the top of the file: + * + * To read the value, the kernel must perform an IO_READ(TIME_LOW), which + * returns an unsigned 32-bit value, before an IO_READ(TIME_HIGH), which + * returns a signed 32-bit value, corresponding to the higher half of the + * full value. + */ switch (offset) { case RTC_TIME_LOW: - r = goldfish_rtc_get_count(s) & 0xffffffff; + r = goldfish_rtc_get_count(s); + s->time_high = r >> 32; + r &= 0xffffffff; break; case RTC_TIME_HIGH: - r = goldfish_rtc_get_count(s) >> 32; + r = s->time_high; break; case RTC_ALARM_LOW: r = s->alarm_next & 0xffffffff; @@ -216,7 +226,7 @@ static const MemoryRegionOps goldfish_rtc_ops = { static const VMStateDescription goldfish_rtc_vmstate = { .name = TYPE_GOLDFISH_RTC, - .version_id = 1, + .version_id = 2, .pre_save = goldfish_rtc_pre_save, .post_load = goldfish_rtc_post_load, .fields = (VMStateField[]) { @@ -225,6 +235,7 @@ static const VMStateDescription goldfish_rtc_vmstate = { VMSTATE_UINT32(alarm_running, GoldfishRTCState), VMSTATE_UINT32(irq_pending, GoldfishRTCState), VMSTATE_UINT32(irq_enabled, GoldfishRTCState), + VMSTATE_UINT32(time_high, GoldfishRTCState), VMSTATE_END_OF_LIST() } }; From patchwork Wed Jul 22 16:48:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1334039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=JfLbaKfH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBhWc71bKz9sR4 for ; Thu, 23 Jul 2020 02:59:08 +1000 (AEST) Received: from localhost ([::1]:47652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyI5C-0005z5-Lz for incoming@patchwork.ozlabs.org; Wed, 22 Jul 2020 12:59:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4i-0005vb-Il for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:36 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4g-0002hc-Rh for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595437114; x=1626973114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eahIFHRMeR0LnO7tgOyPitM8oejJA4NIGSEjXK5pM8o=; b=JfLbaKfHLP6/A91sqdn17maa3QWtVjc4Kf7Vuvgl8HOmTDsFWFf/x8B8 OwTtP5+BnoaJ1+uhOWaWGVfOg72SpicDWlW1Prpiq7GTNJZMG6E2kRdHI GUOkjVesDF6OJSdYFvC+WEHi1grHSubvlCa32GBAtRG/WVbOcUzlV0hFp EbTwR83fLTohCPcEQ/0juwoXvpXkqMmHHAWUuc5NCJhcuKzSv3ktPYQE3 pCPSu1cXLhXL1fvUsnRdrZYl3mmRYD4BONHDqoKNpNHDH/7YElzoNONSC xUDl1WJX0NQuwB5ULZNqprnBFvkBf5KlCf4b94Oe/GSX92WYb8U2R1M3C w==; IronPort-SDR: 48AHoJKr2inbsLChdOCOXuDtGORRtuid25aSnNrTAK4RDrWemlmBCawn+kNZP8MtSEyraINwg5 Y/f92elLhS5GkEhmYo9Y4LWZI+7xRtLoo2dH2SQEet1W+5nOp1RQErsm3IpJ9oTEGfj7gcgVqM /wt6S1RH9FxFprTl8WNaycVGDnuIrcmZc/MaUW7l3AhpAnSyeITNEyYR6co8UA2MoZBB9ALRcb hYmNzxOduAIRntkzJV6Aq9lpplscs27ae1pGpj//tqkeAiJc3mLG7JpknWKRUmnRgY3M9uY8qV 0K0= X-IronPort-AV: E=Sophos;i="5.75,383,1589212800"; d="scan'208";a="252418635" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2020 00:58:21 +0800 IronPort-SDR: jFJyApldowyMXXzxnJsDX+JWKwxIcLaLYw7RU91W/b1L3CRKoeXhvup1jwPI1Er/DH8HdIy6rT 9+GfqqhuJ8QPRXmvs/zLFKLKai/+EkliU= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 09:46:38 -0700 IronPort-SDR: D+NuNUA7RVmU2zAKy1+pSyUxkRjF76Gb58HiZValYhdkd0+LDAZ72h0cn6ADnYj70zxYtzFGhI pzq4NGdIudTw== WDCIronportException: Internal Received: from usa001575.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.58.115]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Jul 2020 09:58:21 -0700 From: Alistair Francis To: qemu-devel@nongnu.org Subject: [PULL 2/5] target/riscv: Quiet Coverity complains about vamo* Date: Wed, 22 Jul 2020 09:48:35 -0700 Message-Id: <20200722164838.1591305-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164838.1591305-1-alistair.francis@wdc.com> References: <20200722164838.1591305-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.141.245; envelope-from=prvs=465c3c755=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 12:58:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Signed-off-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-Id: <20200721133742.2298-1-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis --- target/riscv/insn_trans/trans_rvv.inc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/insn_trans/trans_rvv.inc.c b/target/riscv/insn_trans/trans_rvv.inc.c index c0b7375927..7b4752b911 100644 --- a/target/riscv/insn_trans/trans_rvv.inc.c +++ b/target/riscv/insn_trans/trans_rvv.inc.c @@ -733,6 +733,7 @@ static bool amo_op(DisasContext *s, arg_rwdvm *a, uint8_t seq) g_assert_not_reached(); #endif } else { + assert(seq < ARRAY_SIZE(fnsw)); fn = fnsw[seq]; } } From patchwork Wed Jul 22 16:48:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1334042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ltEoMbyI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBhZt4yP8z9sR4 for ; Thu, 23 Jul 2020 03:01:58 +1000 (AEST) Received: from localhost ([::1]:59140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyI7w-0002Fe-9X for incoming@patchwork.ozlabs.org; Wed, 22 Jul 2020 13:01:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4j-0005xW-No for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:37 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10279) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4h-0002fu-UT for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595437115; x=1626973115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P/k2D2D4QAIblvv6h3Y5Rw3h3hsa6l5k5jMFvrCStiU=; b=ltEoMbyI5THOI4aB5bPIwnB0Lb3BQOXvZCmay2zBHVTkpdQZonjJX05L xR2b30fppbkZ0JqqBprOdXTusNSafUHnc9vtI1s1kZJX04+0x+ATQ/HDU gqgvBFb5QnyLmbLCPb/Zx/ReoLU7ggjURRbCKaKEfuLxHNef3ZIpoEkFq PbKTxfYP8s2eQXrznceDjR00JIImuVSPAtVen+6m1a0kxHbu2JJlo1EBn 7dM6y9Fr5qKSB5XBbkAmozf9zXqGkwNFHUI+cBlWBhDH60Iv1VUnZVlC2 MCwSQjD7fqcmp+YpNZ/0FzIMmmommO7JZqdpcPX+DGlRiYIV9jma8IMlV A==; IronPort-SDR: NpYMQFqaM/ip+O/qW9tnzt3RxEUNKi8UPSD8EgBrlb/BUKl4/+JbTFuhOGH29NREekiwWuZOWH 8BieRbgX2O8yehfGJtS6w/jfafQHZktZtkAw1mFrakikVv+M38EiL+eEa+hrJ3HnbVncIjxRGI aXOmp2ZO6rkX8Qhb/FHrmuHVMILUgTUoG4Xk3HDMjICjM1u8NQ1ngEFTZde3e3izfKbgKm75Lg GrPqUF3BjUS3k56qFVwrkAUder7qrcnJa0bzJCsyGoti1/w1pCnMdLztCCNdCBksR1fV3bfjht TeQ= X-IronPort-AV: E=Sophos;i="5.75,383,1589212800"; d="scan'208";a="252418636" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2020 00:58:21 +0800 IronPort-SDR: hTMyhXynS3PWceY5QtaEPQla3z9HDNWfZFMCFb8WQXVxwDAwntC/DhwKTop+FuAlp4Dj/XAPcq x4PCbRP7Gci4+blhW4RsbfXIfY8OwtU78= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 09:46:38 -0700 IronPort-SDR: 4KkGJrx4Q5uTgYlouEphm1GTAmo3xFA9w4OtSEzxFdjHM5yA5crYWvbS9IX8GzpQe/9otaDn4E QCQvV2CkzCCw== WDCIronportException: Internal Received: from usa001575.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.58.115]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Jul 2020 09:58:22 -0700 From: Alistair Francis To: qemu-devel@nongnu.org Subject: [PULL 3/5] target/riscv: fix vector index load/store constraints Date: Wed, 22 Jul 2020 09:48:36 -0700 Message-Id: <20200722164838.1591305-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164838.1591305-1-alistair.francis@wdc.com> References: <20200722164838.1591305-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.141.245; envelope-from=prvs=465c3c755=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 12:58:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: LIU Zhiwei Although not explicitly specified that the the destination vector register groups cannot overlap the source vector register group, it is still necessary. And this constraint has been added to the v0.8 spec. Signed-off-by: LIU Zhiwei Reviewed-by: Alistair Francis Message-Id: <20200721133742.2298-2-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis --- target/riscv/insn_trans/trans_rvv.inc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/riscv/insn_trans/trans_rvv.inc.c b/target/riscv/insn_trans/trans_rvv.inc.c index 7b4752b911..887c6b8883 100644 --- a/target/riscv/insn_trans/trans_rvv.inc.c +++ b/target/riscv/insn_trans/trans_rvv.inc.c @@ -513,13 +513,21 @@ static bool ld_index_op(DisasContext *s, arg_rnfvm *a, uint8_t seq) return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s); } +/* + * For vector indexed segment loads, the destination vector register + * groups cannot overlap the source vector register group (specified by + * `vs2`), else an illegal instruction exception is raised. + */ static bool ld_index_check(DisasContext *s, arg_rnfvm* a) { return (vext_check_isa_ill(s) && vext_check_overlap_mask(s, a->rd, a->vm, false) && vext_check_reg(s, a->rd, false) && vext_check_reg(s, a->rs2, false) && - vext_check_nf(s, a->nf)); + vext_check_nf(s, a->nf) && + ((a->nf == 1) || + vext_check_overlap_group(a->rd, a->nf << s->lmul, + a->rs2, 1 << s->lmul))); } GEN_VEXT_TRANS(vlxb_v, 0, rnfvm, ld_index_op, ld_index_check) From patchwork Wed Jul 22 16:48:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1334044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=h0l3U9Bm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBhcp3bqdz9sR4 for ; Thu, 23 Jul 2020 03:03:38 +1000 (AEST) Received: from localhost ([::1]:37310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyI9Y-0004sE-6p for incoming@patchwork.ozlabs.org; Wed, 22 Jul 2020 13:03:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4k-0005yV-B8 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:38 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4i-0002jR-Gs for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595437116; x=1626973116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wjZgWmbxiWOu+2b26iONQcOU3qvLXTQffE2z6wWEdj8=; b=h0l3U9BmVtHvyrQgFkQQ826Wf8oF5stpcbjn2fYotNN+ukVkcfgKHl5q ZirDBUkDlV59Vx5KFVllS7HaRQqsgB5/rx1udE23xSfDfNJnkQaVqEI0C 5zr8iUCtwMUyXSoXDNRwpRwcMEpsS9he1pHQA8LMp8aW/jwGb4Dojph+0 1cFQioz3wXw+vHa3lQUFmbQDIo+1mMEEOLD2xcK/BqLSqdmfwD6A13oyt 96b++YDgx9aRJOzNf3uwaNJJKODGwut+AmbwDvREInUkAVF9IG/As8vhZ jzH1CjMFQ7Mu1LuOKL1C5Wuvk0kflcV8mJWW6+Q9rj2B45InBKpbL8JXl w==; IronPort-SDR: 47UmbFsWVpltXSK67u4vkyGnZLfHLD5/Xp3Cvy4t1goQvsaurwBa4YoQySJn5zuiGggQ2qvDJp MkI/n7Vrxw8QWlOZ+ntmO2GXFZyquc/MzouAlzBP3d88ll39iq1gxpHN4Mj6uh4V8ANwCp1MVy 7dPlYx1G1dIUXZm5asrXbzYJYgcb0UkjsSztJCbu+85f/iQmk8RNIlBBHfYIoYuTQJwiyTQ3ht AJooogJc9Kgfs4WQURJS9J49r+K9fsNznAgUKmWZf0Qu4ssr3AHSY2Zh3I2NNtPwVL+a2aQVqK Qaw= X-IronPort-AV: E=Sophos;i="5.75,383,1589212800"; d="scan'208";a="252418637" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2020 00:58:22 +0800 IronPort-SDR: Pak/mhMkpKhQd987pBUjTY2yJjYbier79RFYG/8W1TzQa27lwNVoE/3vmDMFVGoGTuFWP66Ded a/5bMVbfBsnc//+yanwaVVNXIIXde0yKY= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 09:46:38 -0700 IronPort-SDR: 69Cyq7dqMU6gU5W9HJaRjo8woJJr5TB+hhXvxmKAA1GHzYdl5SXY7kQKXsGLFcs6MSJ5I4XXLA tyr21Upibrxg== WDCIronportException: Internal Received: from usa001575.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.58.115]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Jul 2020 09:58:22 -0700 From: Alistair Francis To: qemu-devel@nongnu.org Subject: [PULL 4/5] hw/riscv: sifive_e: Correct debug block size Date: Wed, 22 Jul 2020 09:48:37 -0700 Message-Id: <20200722164838.1591305-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164838.1591305-1-alistair.francis@wdc.com> References: <20200722164838.1591305-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.141.245; envelope-from=prvs=465c3c755=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 12:58:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bin Meng Currently the debug region size is set to 0x100, but according to FE310-G000 and FE310-G002 manuals: FE310-G000: 0x100 - 0xFFF FE310-G002: 0x0 - 0xFFF Change the size to 0x1000 that applies to both. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Message-Id: <1594891856-15474-1-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Alistair Francis --- hw/riscv/sifive_e.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 7bb97b463d..c8b060486a 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -54,7 +54,7 @@ static const struct MemmapEntry { hwaddr base; hwaddr size; } sifive_e_memmap[] = { - [SIFIVE_E_DEBUG] = { 0x0, 0x100 }, + [SIFIVE_E_DEBUG] = { 0x0, 0x1000 }, [SIFIVE_E_MROM] = { 0x1000, 0x2000 }, [SIFIVE_E_OTP] = { 0x20000, 0x2000 }, [SIFIVE_E_CLINT] = { 0x2000000, 0x10000 }, From patchwork Wed Jul 22 16:48:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1334040 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=ik2M4cv4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BBhWh0pQbz9sR4 for ; Thu, 23 Jul 2020 02:59:12 +1000 (AEST) Received: from localhost ([::1]:47874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyI5F-00065K-ST for incoming@patchwork.ozlabs.org; Wed, 22 Jul 2020 12:59:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4k-0005ze-VI for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:38 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyI4i-0002hc-Rn for qemu-devel@nongnu.org; Wed, 22 Jul 2020 12:58:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1595437116; x=1626973116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I0pdoDeme+HuR5fVQ6XAsARi8mHiU5f3Dp/ZaZKJpnE=; b=ik2M4cv4m8HNpZlduvW2YLc2M1/MWRDi/65e6xWQCFzJnffsOlyUJJM5 Etc9pJntMzRk32qyNhobmniQsbHWQ3fi6saQjPlNWo4U0+lSiO9V0rYDZ XQ4TECcrzsJ+rovPJIxjpEvn1kH8P7iiOTEc0PGN1GOlk4mA3fHx63qlT hU0Rfb1/cAMvYbA9bQmfN+0MkLkvV5Ia/wMLqt6desFI9di7Wvtmv9TlA WbTMxbeSAtpjHBVqRUOHPlX+Ewv1Ob7YsvHF1Rw8hgDyhnF5pYthV5VHq iw60iEtYraPPHzmLr9l0zbLoTH33NLNEQT5fAURP0MhcO5M69V8PruP2t A==; IronPort-SDR: lkzvQ3cWkP+ZeOgpxGB49noS8iUNz8bJojKatm7LetoPuYdOdjkZE0hK8Slz1xa2SFMCkEdqe8 WZUB5h95TyCjcmZRTf9U++aGJznKcLr2BQK/R4XJJwLUo9BwjhRJj+1cD139LcF6nggqDfJkqo hcJYcWMqEhXGvc0MkAHQJukcZsqVNYCYFxAdfWLlUyvkp6Atb90qCWlDMM+71xD+gJp+LvfIGB +ZyISc44wgjXaf8YC9K+UWnEzTyBMm+Hv1X2ujVKc97xF4Bs2OsFH/e5NjyBRkOANn4lrSniwX Jm4= X-IronPort-AV: E=Sophos;i="5.75,383,1589212800"; d="scan'208";a="252418638" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2020 00:58:22 +0800 IronPort-SDR: Ufn2PwBWqxXIaQpjg+7WN8QUCuUKAup0S5wLuGnYhRabQtH6R3S7n0YOJkGzD1Eja/XKayScsg r+c87DnRiTczg4kmn6jyHM4/yQbVs822c= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 09:46:38 -0700 IronPort-SDR: E3uBad/5vTPgNF75YGMPh4naLr9RsLM5MGVgtHKEue1EV7yNHVM2W6UcGoymQypMT9Tk4m4OkX s2Ql/PnPmLkQ== WDCIronportException: Internal Received: from usa001575.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.58.115]) by uls-op-cesaip02.wdc.com with ESMTP; 22 Jul 2020 09:58:22 -0700 From: Alistair Francis To: qemu-devel@nongnu.org Subject: [PULL 5/5] target/riscv: Fix the range of pmpcfg of CSR funcion table Date: Wed, 22 Jul 2020 09:48:38 -0700 Message-Id: <20200722164838.1591305-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164838.1591305-1-alistair.francis@wdc.com> References: <20200722164838.1591305-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.141.245; envelope-from=prvs=465c3c755=alistair.francis@wdc.com; helo=esa1.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 12:58:21 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bin Meng , Alistair Francis , Zong Li Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Zong Li The range of Physical Memory Protection should be from CSR_PMPCFG0 to CSR_PMPCFG3, not to CSR_PMPADDR9. Signed-off-by: Zong Li Reviewed-by: Alistair Francis Reviewed-by: Bin Meng Message-Id: Signed-off-by: Alistair Francis --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index ac01c835e1..6a96a01b1c 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -1353,7 +1353,7 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = { [CSR_MTINST] = { hmode, read_mtinst, write_mtinst }, /* Physical Memory Protection */ - [CSR_PMPCFG0 ... CSR_PMPADDR9] = { pmp, read_pmpcfg, write_pmpcfg }, + [CSR_PMPCFG0 ... CSR_PMPCFG3] = { pmp, read_pmpcfg, write_pmpcfg }, [CSR_PMPADDR0 ... CSR_PMPADDR15] = { pmp, read_pmpaddr, write_pmpaddr }, /* Performance Counters */