From patchwork Thu Jun 5 16:26:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 894187 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:ecd:b0:3a4:ee3f:8f15 with SMTP id ea13csp43406wrb; Thu, 5 Jun 2025 09:29:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJjMsEnZDo6SLNxzmFODNvXRYb0wPjzltIn6n4XzK05GY2KrtpP2JGr1QDve8A6zGsexBdEg==@linaro.org X-Google-Smtp-Source: AGHT+IE9ZZmETjbMWkw6TVoZ5XRP3+fgjvQNtkOVhbpJd04DYFW5NLrc0rnTY6Q8/aHMvWyf9KaY X-Received: by 2002:a05:6214:e49:b0:6fa:faf7:7545 with SMTP id 6a1803df08f44-6fb08f89f5emr1271986d6.31.1749140950346; Thu, 05 Jun 2025 09:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1749140950; cv=none; d=google.com; s=arc-20240605; b=ajOD6KlHL3QqqzF8OCE+KTJZbKRrZDYCm4cPZnJjvuFKVtqf2QBiVh5KUznL+Dvf5n 0qJ8LJTnfsDCe09d+HdEYFzIF0QQcJ26u9tQKqrFxLPKRDXdIz0oPpGo39FwhS6XT/8o lpjcRxSkErA9CgKZN7QZ2w8TxGKgxsm0uZtvrjhU+AwucZWeiB+pD1mJdOzBF3sIaDv5 TA4dfZ3k1dO0Rbj3jCFImrgUxpM0opXdfVAZzBQrq7Vesoga4hMZ/DhD1KGjJUS/ub38 Vr+pVSPhZi59BXSLOwGAv62z1PTw+X10sAV63ANw1t606e14GlvUO06453gUl0gat77k VXfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=0vA5SxIxLA+Xz/34QHBA8A6/byxaPtxZW/N/rmkKPYk=; fh=mY856SNJwkgjlqivCByJ577Y3zGjlHxCpwtRxQKZ10E=; b=Q/+EdSRmzHZKdn6FkHqPGeYuzht/yv4urHb10868OuvgT8omK0Gk/5tAg100Rkljoa KrnCq1oXnW/INoVKsIWmAE2LC1rZyaQrLk9KY1bekkOOYuVfMrK63pq3UpbDUj/GijI9 VN4UAkcu/wumki1CIxPSLZ+yHkrTPX5R0lAS5UrqdLu8gQ4d4nsYmRUy8EKJLLoRqUyW EUuxyouKFRYMPtFtsDquRRHCn1yRM3mII/jYoo7xZuSJ36b7L+9YI+cvgDnDi8D37cIQ Bxzvw3npambGTxcBOY5v8W6AreOgNDMjqZX+gHhfrvR733kKLJtaBHeCvyyaa8APjlQ1 3pHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uEZ7qWLz; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7d09a1f9558si1760183285a.340.2025.06.05.09.29.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jun 2025 09:29:10 -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=uEZ7qWLz; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uNDQi-0006yt-9Y; Thu, 05 Jun 2025 12:27:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uNDQg-0006y2-Ts for qemu-devel@nongnu.org; Thu, 05 Jun 2025 12:26:59 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uNDQe-0007vu-J2 for qemu-devel@nongnu.org; Thu, 05 Jun 2025 12:26:58 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-adb2bd27c7bso188933366b.2 for ; Thu, 05 Jun 2025 09:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1749140815; x=1749745615; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0vA5SxIxLA+Xz/34QHBA8A6/byxaPtxZW/N/rmkKPYk=; b=uEZ7qWLz25JECCmRG1Dv0PEnbJwYYiYSd//yzthQnfyhFor5fkpjyf8ZKQKt9+yn8k yoQCZEjY25QiBrB1m+CDtRA6HL2TwziOeswEeuN9n0pGyDx+XWsy8GIlAyS/i35BcM1b Vt0wOoZGszzyjlP4n9Fhw3sJusrH+ckTsS/3wspGYoQsShclxQeHPc3k0pO43KmjNhAi Ri51qo3R5J4DZfg6pkJz+7/cnCEnYXt++RgHDry95aEo2/GmfNAgRGkqSwW3h1FxtzsR +hGdvEt9T41COnvgcdzkXwnw4bljedTzMt8osMxHV8xag7NWXUlxyws4XXK1HAhtEH01 l7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749140815; x=1749745615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0vA5SxIxLA+Xz/34QHBA8A6/byxaPtxZW/N/rmkKPYk=; b=j/7Bwue1xMOS0NSRxnZSj5ABggPhtmXmwQnU2jTWd6KeTglmLiBCnlLHTLCmY3twqS HhmqIIfKOuj+M7pmPPB1bqebziqU+ZVOeVm+N4/JzV85LFRYV6OwNSCDY1/MEKD4eXKt p8t3PkU/FWGefdFpeRYn2AxySQiRtkiDyQC9m04QpMzamPv06wlyJfLvDwgSwtiQEh0Z uHTSw6pFRrDjO6BFH4XePTOQiNTZsJUIRj0C6gOLdxHlDdQ24oAcPxYp4YyyTosxUvL9 z1i1sCT5d2OoZDGL28WjjJLfFrGaLjC7wRr0anyK1KyU2iirTSZ4dRb4EgKI2J0odktk QcSQ== X-Gm-Message-State: AOJu0YybDT7b5qsf1S26uaw1Og26IKBYd8fAJ2/hO4c36QYhjvno7oeA mwPozjVEXlQjX7Rm4Mb1H2GzhilcCWwK2Qq7VQaGR2k8glJr2rixeCbsM83rYOzceUU= X-Gm-Gg: ASbGncvgrMrzhgByv+X7DWp9mlDkMEu0Ge9d1LbdM4qLLtMdtk6B17VVBYGIbaYvRFg kR60+u/Osz97o6FRP96ms1n4PcvlZ+9TUlXD3sH1h4nulPcI7ED3veS+tdLZH7oTOPXF8jrm+pO 6B0RWoZwWD3ZNQsZNeudmkh5mcHMLdJVFbnlC0WIft2yiN9iQ0ual2/q+6RAtYTXGhY0rxfr+Y5 jGpNfjuyD66YOsQZ3HBJ3gaI+MkewRfqt0CFRBlChVXtXtNRv3+uqWBrDsyo5IOBa2Kds3dyhK8 1O7uMIkMvVAF+n0Z2o2wEZsLKsel/T7FpaYU4naTHl9SskJt9RJE X-Received: by 2002:a17:907:1c1e:b0:add:ed0d:a56c with SMTP id a640c23a62f3a-addf8a813cbmr718258566b.0.1749140814716; Thu, 05 Jun 2025 09:26:54 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-addfae39c05sm260326266b.156.2025.06.05.09.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jun 2025 09:26:53 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B6EE15F7F6; Thu, 05 Jun 2025 17:26:51 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Nabih Estefan , Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Akihiko Odaki , Sriram Yagnaraman , Fabiano Rosas , Paolo Bonzini Subject: [PULL 04/17] tests/qtest: Avoid unaligned access in IGB test Date: Thu, 5 Jun 2025 17:26:37 +0100 Message-ID: <20250605162651.2614401-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250605162651.2614401-1-alex.bennee@linaro.org> References: <20250605162651.2614401-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x629.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Nabih Estefan ../tests/qtest/libqos/igb.c:106:5: runtime error: load of misaligned address 0x562040be8e33 for type 'uint32_t', which requires 4 byte alignment Instead of straight casting the uint8_t array, we can use ldl_le_p and lduw_l_p to assure the unaligned access works properly against uint32_t and uint16_t. Signed-off-by: Nabih Estefan Reviewed-by: Laurent Vivier Tested-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20250429155621.2028198-1-nabihestefan@google.com> [AJB: fix commit message, remove unneeded casts] Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-ID: <20250603110204.838117-5-alex.bennee@linaro.org> Reviewed-by: Akihiko Odaki diff --git a/tests/qtest/libqos/igb.c b/tests/qtest/libqos/igb.c index f40c4ec4cd..ab3ef6f0c3 100644 --- a/tests/qtest/libqos/igb.c +++ b/tests/qtest/libqos/igb.c @@ -104,10 +104,10 @@ static void igb_pci_start_hw(QOSGraphObject *obj) e1000e_macreg_write(&d->e1000e, E1000_RDT(0), 0); e1000e_macreg_write(&d->e1000e, E1000_RDH(0), 0); e1000e_macreg_write(&d->e1000e, E1000_RA, - le32_to_cpu(*(uint32_t *)address)); + ldl_le_p(address)); e1000e_macreg_write(&d->e1000e, E1000_RA + 4, E1000_RAH_AV | E1000_RAH_POOL_1 | - le16_to_cpu(*(uint16_t *)(address + 4))); + lduw_le_p(address + 4)); /* Set supported receive descriptor mode */ e1000e_macreg_write(&d->e1000e,