From patchwork Mon Nov 18 12:46:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844080 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp594753wrx; Mon, 18 Nov 2024 04:47:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWKiGRT3E0EnWsz8wMd7ZQY/QKgo0Hc2YDhEw0tMCZz62MQs94I5xGCVuXAv3WQW5qU2NDkMQ==@linaro.org X-Google-Smtp-Source: AGHT+IH4fpGLJ31xcWgwPDdwtoQ1QviU8s8C0y056NrF709LX/EOdJV3R2BgNt/r8/62AgyF73El X-Received: by 2002:a05:6902:20c9:b0:e35:e0c4:a06b with SMTP id 3f1490d57ef6-e3826154fc1mr9681464276.25.1731934045785; Mon, 18 Nov 2024 04:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934045; cv=none; d=google.com; s=arc-20240605; b=H+CKcHlewp7nV3l3r/UV+b+nlI0ZJ8yW3buMqZee/PM6fsu5Bo1hfGjiIOkxujlkyx i+krwjIGdCN85+jhStuXsV1R0xztDaU2RHFKausd/kmnTPnP/QBOgQcxEQ+JpRSH9y3c DHjP+9BuKM094cO+Qu9qH+0SwlhrhrxYi3LzCBSPYO9AIKBHHz3zxWU9KzPkgoSeKrVw VWD+oIGM+ab3f85p7iNHGz5voME/2B/xz64IbyBwXuDccoFKVCIM0Jkz4UHO7c0JMmR9 ouqVtXT+mF+HzbNvJoo7gWPZBXkfbohI8ZuSsxj3g+kyaIVWqpe5FVZV/yXIh0GpVVQs jQTQ== 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=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; fh=9H/vzCbdZQrHTCz32qxUzDnCtcSUm7Jegh0ArlcduT8=; b=fSr/f99xs8Z8whcLmAX+xEHmdD0if53Z3wNuVSJR4QrBe3rcI/0yiO/SsqW3ZhY9Y0 XW5l6c134hoB16UzOjmF2gGzxWTgQqxvJqbhzsAaUcFhO1sopIBqrqRzVdhgEHSATkGU AA+6oM2dsmdA91cuU2dSqXaX3/CPpfPX5N0KbZLnph00Qj3go0a3f4ny/eg/5jO3RFf3 Qba+/avZ6NPwIppj0R6NMEf6Gv+4eSPTXX2k4c/RuxkUqbFdQWPYXPQxZvpkXmetznd1 ieO9qaaa9xuiP27oD35XpSNpY27qVbtPHvF0yxmg2k/+uoRaOitdhmZlyVxDCyzNvSgm MDwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZDe7FS/m"; 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-7b35cb06e40si1026564985a.697.2024.11.18.04.47.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:47:25 -0800 (PST) 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="ZDe7FS/m"; 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 1tD19f-0002xl-Sj; Mon, 18 Nov 2024 07:46:59 -0500 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 1tD19a-0002wr-Mq for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:46:55 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19Z-0005N2-7P for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:46:54 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-38241435528so937771f8f.2 for ; Mon, 18 Nov 2024 04:46:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934011; x=1732538811; 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=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; b=ZDe7FS/m7dVGLzDVi9InQBFshmcSamru3ErZviG0TX+0DWPpJxvu9MCHPq4+OcZm65 mBsZKm9T/5I1j0/9f9HKC+blNbWX4QfJa0dD3cLuts6l70PTtV2rurEZ7I8uyKws/QCm qTp4Gt+yCV3GOia42C//U6eqE5tDdnb8UxqOcdxBCt2mOcKhOSjcXI2OFzx4NNEotrK8 iwFdQ6U3u45MdB3LxnL7balTUy/gw5jgnE288uJHipy0iQpV+02pxxl517MNPblg+X8h yCtkQNEpxosrlk11CcC9f3Fdo2t5VmK5PVAlaGNzytfkW3KBzAReUZ1QZreyUBaonQ9w l4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934011; x=1732538811; 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=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; b=lziW4dptPTUtOiZVFXJtD3Hw0XTWGzqWW5imPIvKWmJrLVEMZiLD1vHzevFu/E3Iu2 IBs1OZClP+r6XvoAlAX7InxQcR9rB1yCATYcc3e1T/O2QziKkmDMsBQB0KSYOyxDkGMc aBiev/hjZoiDYJaHMfsNgLI4w7fcny3mwiVlIdHGPJ9s+b4yzAcFdRWmSHTmGVr21bYi F4JGAI5xnQvYX3WQhO8vjs2vwrcOv5J65wCRxWAWf/tlSRml9AqJVD47d/DaWI0U9ehJ 9UMpo+iUurckgwlk3xBsLV3p0YsixRPLH3bP7nRxJrXNdk6rLTLIZDOWkrQL5k6KzNUx hJHg== X-Gm-Message-State: AOJu0YyMrI2cO23Wix3XE6gAXKX5m3ekJVIW/Xf6bkwDGP8vMTbm5/e1 f7P2q3ZI3GuQqQKefxGJ8JA+AkfSdXNrrF+l84P7IEb7eZF9qF9/0f7wtqIDGTCiNMgfllk8mbC m X-Received: by 2002:a05:6000:782:b0:381:f595:fd0a with SMTP id ffacd0b85a97d-38225907a2amr9456944f8f.16.1731934011413; Mon, 18 Nov 2024 04:46:51 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da298760sm157802675e9.37.2024.11.18.04.46.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:46:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 01/15] vl: fix qemu_validate_options() indention Date: Mon, 18 Nov 2024 13:46:28 +0100 Message-ID: <20241118124643.6958-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240905141211.1253307-2-kraxel@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- system/vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/vl.c b/system/vl.c index d217b3d64d..3bb8f2db9a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2427,15 +2427,15 @@ static void qemu_validate_options(const QDict *machine_opts) const char *kernel_cmdline = qdict_get_try_str(machine_opts, "append"); if (kernel_filename == NULL) { - if (kernel_cmdline != NULL) { - error_report("-append only allowed with -kernel option"); - exit(1); - } + if (kernel_cmdline != NULL) { + error_report("-append only allowed with -kernel option"); + exit(1); + } - if (initrd_filename != NULL) { - error_report("-initrd only allowed with -kernel option"); - exit(1); - } + if (initrd_filename != NULL) { + error_report("-initrd only allowed with -kernel option"); + exit(1); + } } if (loadvm && incoming) { From patchwork Mon Nov 18 12:46:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844078 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp594650wrx; Mon, 18 Nov 2024 04:47:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWWxdmQS1rvEI3DZrCQWFAm8YrbsOlBnknvwp595ecE6fVWKt/uqWSyqfq0dhqilYJRQJTU9g==@linaro.org X-Google-Smtp-Source: AGHT+IH9083MwKDfUkaJqsoM6UyzpdWsE2Rgo9TBl/7omjwRaT/T7KGo21MaL/+WOsT0uDDh7+Yd X-Received: by 2002:a05:622a:4cc4:b0:461:43d4:fcb4 with SMTP id d75a77b69052e-46363e24910mr187751021cf.26.1731934032614; Mon, 18 Nov 2024 04:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934032; cv=none; d=google.com; s=arc-20240605; b=Mh7a7dyee+IEguRrPcn6K5xXq+UCGlLlYWyRqLJukFjNUu9ZS1PYmO8cOqiiODgp6p /t2AV/S0OPgGiGSLf/c19y8ZEPqWATy7sbDbH6kWnu5zRtD3BOwpDkFFPJWLwBGpSwcx VPx5ITwMzpNHpyTq8HmkDrKQGmcwMpJNbGGxlpaOXucFsqUGIyU0m+UEEvYfEHuKUTv0 Qr0ZlMaPa+JqnmW7ZSpScfqVods0JjjnqCO1SwV7uOW5in4eEdoGWARj8NUySqk0X5Ki UkATQRfRG2NEPD3JM5k2vhc20m9ckxtLqkEjNyefaVw4Ot//J3sfUWpKwKIN+f8A0Lhz VYEw== 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=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=kQD8d4QasVEcG2PZVEIbx29MZalMLdCiMRQHStzSvKtR13BoKpJ1QZYrVoflR1ipnG AGZDC3N+/J000oGyv8SOl7wjVu/n3thQ4Buc/Sw3hO8+0jE6rz7i+kkbPblDmrccwnK2 GuBp4Hz7WVNEjpkBhPWX6pvidtliT0v4ZhY+zep8UotmneyzWC96m+4d3WNPhLH4cbIf KvTESRtYDhushEpToYr8nUvcu+Rn0ttS5VZTflQ/YAGnv8vKXyYXm6cdmjtAiA1RCR1b NyKfktnoIM0p0spKwlRCb+Nb2IlCZtvHKgsiiRZDeAsiXx/0akix9iurKtReShphlYAo rorA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OQO2a5SA; 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 d75a77b69052e-4635aa9f1bfsi102875171cf.245.2024.11.18.04.47.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:47:12 -0800 (PST) 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=OQO2a5SA; 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 1tD19h-0002y5-T2; Mon, 18 Nov 2024 07:47:01 -0500 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 1tD19g-0002xv-Q6 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:00 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19f-0005NO-1f for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:00 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3824709ee03so651954f8f.2 for ; Mon, 18 Nov 2024 04:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934017; x=1732538817; 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=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; b=OQO2a5SAdBdsaCE8oBcaWZ9Qz3Okoqm9VRw+ZB5IRJvvrRY+67j0fBWiNgoeLRGjcu TKbIBs3bmM/ExMXXeF5v0hesqVCHOf+Yh6MHqiNlg7hK0gw5AppC8e9aai9sRGmocLoI WP3/yHdaMFQnRUf1BIk438xJiF9NS+MwAX8de6qnFbOvZBfCI9BE6EBWsVxa+mNV3zGK NvG6x8/FnYs+sGMGsg72NmjApuqhBSlR4lfFtvJl/R+sG3D213O07pPX0AS7gRpy66EY dQnhaqgzJz38EGHlR5DG1X2ohtmu0HuQTZI2OjrswiyP/nPQvjCqtVZskkbjBVVc8vD8 n1lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934017; x=1732538817; 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=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; b=t9Ee243pmeVRddzxNaVHgOOxPI8MjgCNZN3X/PAFVyqW8DbfSUl2joBKL7Yb+4Q+zI VAMWDm9f6hKYf+VpSoKqfF7tx6vPQAyq4FmOf/G6Eu88/Fq4KxpITZDyCf2/bjRORbkK pv0HWRqdjd0eS5LjA+iDE+ZZ2EjDNjUm6vqEik/4z1dro9pZn1U6KVEvJWcCpGmtWD3d 6yKQ42oWXl6r//OlgPHU7xAZe+bWAdbrPtBxIMy8ke/tORfgkN3KSQ60P5ueS2u4x38r fcnba2hA6ULmpkSPNuwi5hGlnH3cwyp+eivfVjEl/cWpenilqmAw8u7gASa8rdUNTaHI GyqA== X-Gm-Message-State: AOJu0Yw342X5CLgrhjo/Rm69Z1D1yvp/tF9kQdDqUzyl5Q1C8OKoFkfs KgFGcsf8h6VmxcMZfyVnh6aSUFkHmhGvRxFWjJY1R7Fg0y/Ew7KMyEbF9M9ogGf4xTUOTw94rN/ V X-Received: by 2002:a05:6000:188f:b0:382:450c:25ee with SMTP id ffacd0b85a97d-382450c2aa8mr3968418f8f.40.1731934017117; Mon, 18 Nov 2024 04:46:57 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3823d253773sm5992907f8f.36.2024.11.18.04.46.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:46:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 02/15] hw/misc/nrf51_rng: Don't use BIT_MASK() when we mean BIT() Date: Mon, 18 Nov 2024 13:46:29 +0100 Message-ID: <20241118124643.6958-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell The BIT_MASK() macro from bitops.h provides the mask of a bit within a particular word of a multi-word bit array; it is intended to be used with its counterpart BIT_WORD() that gives the index of the word in the array. In nrf51_rng we are using it for cases where we have a bit number that we know is the index of a bit within a single word (in fact, it happens that all the bit numbers we pass to it are zero). This happens to give the right answer, but the macro that actually does the job we want here is BIT(). Use BIT() instead of BIT_MASK(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241108135644.4007151-1-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/nrf51_rng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index bf1eb0cf4a..2d67f3f766 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -107,25 +107,25 @@ static void rng_write(void *opaque, hwaddr offset, break; case NRF51_RNG_REG_SHORTS: s->shortcut_stop_on_valrdy = - (value & BIT_MASK(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 : 0; + (value & BIT(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 : 0; break; case NRF51_RNG_REG_INTEN: s->interrupt_enabled = - (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; + (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; break; case NRF51_RNG_REG_INTENSET: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled = 1; } break; case NRF51_RNG_REG_INTENCLR: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled = 0; } break; case NRF51_RNG_REG_CONFIG: s->filter_enabled = - (value & BIT_MASK(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 : 0; + (value & BIT(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 : 0; break; default: From patchwork Mon Nov 18 12:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844079 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp594711wrx; Mon, 18 Nov 2024 04:47:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVL1/oCCtyzjYoBX+fux7s4amfJD3LgqRLi6bu27AP5Jyohrp42Izl6xEu0wZSQL6jXwOtNnw==@linaro.org X-Google-Smtp-Source: AGHT+IHRXlsj7B1rIh0zUoAm/108NwCSHX1KV9xxLVvCqvNA/rxfuod/2bb2VPElb/k0GQTSnfPR X-Received: by 2002:a05:6214:4306:b0:6d3:ac2c:c43b with SMTP id 6a1803df08f44-6d3fb7a7ec5mr195923986d6.13.1731934040491; Mon, 18 Nov 2024 04:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934040; cv=none; d=google.com; s=arc-20240605; b=OvME6COKxSSgvSlYg3Nn1L6K0D9QkZOISCWJ5LxZ/ukdXn70548SihAWlrQ5UMjVxq HeXpiinuprdS4Dcwe8A8WAXc/YwFLEsqlJ8w5HQYo8bbQWVYecx4qLx6gPwj7derxFOc 7FwqRiK2AooXaA/+ur0J3itU3+be54ZLAPa9aZTqbQ9HQR1QB6HCf/KlsMuAWBDRgynJ D5aYBv+D7F73FkmFnOhJurZXGKUYMCfruG/jOtvqlX6QzfSWyf9G9Yp/24pUTddRQmR0 FB4zYF/Tu6YSbd41e/i3FpIadobh6JxIMiLRfpImkuWQ1rlNI9+Xh4nR2R01akHN8Ghx 5TBQ== 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=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; fh=INBbOnHqZJMYqUEbRsRUJynX5maLU1KhQAe80ndxNds=; b=DMdbY04OOiTKWLZ8+BbShMUAixL6gqGJWfu7C1dQSwm3ak1dZlZefquuxn2PeiyYId KfqkNrYaYN1B9X7BU7wtGVrx2yoa7rN4+d6XeGqj04k3e1xaKM5olGaAqFXxoJ5ZYEpe VK/4hqcEasMmwm4Zsrmy7OZA1f5it76kBt06gey/h8C4if9cPr9jHEgkOUlrwbPsGQNo voZNctChxrHf4JV6PIJvFuATn1Q5yoLC1EWSIyixyMpbFu0Bru6GCjzQbm3GCCbnnvQ9 KZa+NKIsv1N8yPy17NAc6ldhAqbZD5Gf9vVyUFd3OtAV7nDJMoGoIBDJXnEORXf+IqS/ RQ9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BFdlMj8d; 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 6a1803df08f44-6d40dc3fe7bsi63222436d6.249.2024.11.18.04.47.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:47:20 -0800 (PST) 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=BFdlMj8d; 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 1tD19o-0002yz-66; Mon, 18 Nov 2024 07:47:08 -0500 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 1tD19m-0002yd-JR for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:06 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19k-0005Ns-Ql for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:06 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3822b77da55so1514713f8f.1 for ; Mon, 18 Nov 2024 04:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934023; x=1732538823; 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=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; b=BFdlMj8dE1vOYtRZRJP6ljP1/sztQMndGcBWIscTpwK4wwc4aQnvFRMax0FVF39p1i 05slaTO78xIz/zuhiMNGdqzTAFJxvTNekxXGOQUV2LTatkF0cALPC+vwQyHEybx1ox/Y MgHMVWZPOXEq273C7WPoKTSTUcJaHnO841FQLVIFCZ2BQFExCO5UZoo1m9d6pu3Ref2o ELr9X75TxJfw3jlvhuZKpyy0FUY00aEqKWhQ1cAsyB7ZJTNrQ9qpYgJ4j93RZMgavQ9Z OB9MFoEOWpGoiJpe/vqpaBkEhXreZSjmHDQlYlnSEti8IOE6bvLicwGeZpaC9GpKXvuQ tyfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934023; x=1732538823; 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=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; b=Q9ttgvL4HVIO4iuIf9N8Oo8LpoOm9x2+Cxj5WB6ebvVMdbnml9zEwpHD5+S+GXXQp7 G2wZRsL4nfG5uwwqfjkVqAkSLar33NZ+HXrEIR0wGtgThWmx8EcnykeT59hGDHnF9byT Qh09hMmUNJp5dw6ACMDT77zOdLcIsozssRu/WcsMO/zGUph6un656ehRzreyTH1/pUhB p/GDJ1E7zLRWoNi363bschaFuiYHGYvjjxAokZZEdi9VRVYncPFy3save9wGphMddxrg vRbu1ItWbjZomMYv9+ZEQjDAXP9wsa8Z+KjTTHhT7iwr0SbgVQ496jw7O/5fHbdfQp2Q zhVg== X-Gm-Message-State: AOJu0YwYFJcSbjKzVDzir+pvHJcN4o7xJ6/Ky/FnXXkUmpIDCnw6nOaq 8pyCplz50LBTOO72yLzMU4r14c3SKWaomnGMheWhW3MAW1+9D6RaDllI1XYnAyTXQoHizDXOVKN O X-Received: by 2002:a5d:5889:0:b0:367:8e57:8 with SMTP id ffacd0b85a97d-38214064639mr15163179f8f.19.1731934022793; Mon, 18 Nov 2024 04:47:02 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae161d8sm12987275f8f.78.2024.11.18.04.47.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Sergio Lopez , "Michael S . Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/15] hw/i386/elfboot: allocate "header" in heap Date: Mon, 18 Nov 2024 13:46:30 +0100 Message-ID: <20241118124643.6958-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Sergio Lopez In x86_load_linux(), we were using a stack-allocated array as data for fw_cfg_add_bytes(). Since the latter just takes a reference to the pointer instead of copying the data, it can happen that the contents have been overridden by the time the guest attempts to access them. Instead of using the stack-allocated array, allocate some memory from the heap, copy the contents of the array, and use it for fw_cfg. Signed-off-by: Sergio Lopez Reviewed-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241109053748.13183-1-slp@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/x86-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index bc360a9ea4..dc031af662 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -697,9 +697,11 @@ void x86_load_linux(X86MachineState *x86ms, strlen(kernel_cmdline) + 1); fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline); + setup = g_memdup2(header, sizeof(header)); + fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, sizeof(header)); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, - header, sizeof(header)); + setup, sizeof(header)); /* load initrd */ if (initrd_filename) { From patchwork Mon Nov 18 12:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844082 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595083wrx; Mon, 18 Nov 2024 04:48:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWk7Onpv8V9ff4THRMxn2i7SUI3ZOXSckrx7GaK2ll5rf/ieMw2hpqPtYjU0AF27WjoIcPRBQ==@linaro.org X-Google-Smtp-Source: AGHT+IGk5aNAv7UcqJ3Ezi24FFDh+mJabXSD5VqsbfVspDnKIMT9jvijKgtLKHuzOUtdkfEX6+aL X-Received: by 2002:ac8:588f:0:b0:463:eef:bab4 with SMTP id d75a77b69052e-46363e24794mr169308581cf.26.1731934095654; Mon, 18 Nov 2024 04:48:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934095; cv=none; d=google.com; s=arc-20240605; b=hWUvDt5Q3co7e5E2g6aks3onnsM/O1fCadpZmc/FvUmfb9HQOAtKbfcDzmsJisCdZc w/G4gtzTxFJCTnY1QQ41sudm8W7me5lImxqQyY9QwQbXCXOqs7CJvOEPxtiWNY23dF39 LujggzCeKp7sySwX2qHk3tjRY6+OIq1ENZIH/DTD/e1SIx9X7Ns4E8GnwMtrewHr+AYg bKz9gnXmQEGCDrCfBpvsRjDJW1O1SAD3v6LAms0ql+/JuLcfd1Xot0gB0xQk55YYBcOY 3+7p1XnJGPSMQ9x7cW+KwQ9qxa/MyB9QqnEVIPOIFKBoozeUOltlOiGP0pL1+5ODzvbz YXfg== 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=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; fh=Rd6L/sBFZKAs+7WmvdDGFhm2efHDi0nixzl4z8FARRs=; b=aQ7lKAczaR8X2bG1zlo7Ct0kAN/6ZJiW1axwuEVWRH3ZjKWn5Ep+LY9Wq8/2LDkgGd 5XqVZNF6Hv5sy4UsGmwB0sU7ZKl91lk1/uRnIvNrxwgg3EXMWBrvB7yoNSBtT/4i72I9 CIjrqngSEksgdMc85N639b0bVGaWgPtFvEfKonjvqLf3dF335jMxf0m1IOycpEnY9jh+ UlaZiuDa+Xdi9hInVDc0ealTuV8l7C8Mr88EauQTkoqgshIrglNqxIt1ivLPIP1G9qNo JTAu1ucpJeALcYRVtKB7g90oQeb/g0ngiqTKveXSl03JhrA2fo5v0WkSaQN0xixOZqeB vw0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YDp9DHPQ; 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 d75a77b69052e-4635aaddf8csi111849141cf.387.2024.11.18.04.48.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:15 -0800 (PST) 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=YDp9DHPQ; 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 1tD19u-00032R-8T; Mon, 18 Nov 2024 07:47:14 -0500 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 1tD19s-0002zI-4k for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:12 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19q-0005ON-64 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:11 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43161e7bb25so34169055e9.2 for ; Mon, 18 Nov 2024 04:47:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934028; x=1732538828; 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=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; b=YDp9DHPQjmtN/ZX9YNAZFkirT5453yo880ERxT3jBZnrWYxSD9QbfP2LbPT7+tIHS+ gCIUIWjSGBkU7bYZsOPR09eqTWZdedk4qmC2HtH0raCt83jvTKlb3D/hLQIk7VxinOZl JMtipFN/Uz6dvWbSqqMxj5wWVoE0jlDModUJiVbitUllGxNuDcJX0aCIsZtED3ukVcdB mpyQtG/dAqI/6iKzxUB+eXEYlrmOFHFTwm0HOW93XiW2wZ6U8KMiXNx/A2HpRhFwCkPk Q0lQuBmI1rrcqIuADSjwyaj73gctt+sJvAEt4pNR3xGZ+pDcDWlKTzYHicxTzDqKr+UO OCdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934028; x=1732538828; 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=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; b=lnbl1t/vwb6FdB6NEad8eoPzwFuPMGZh1ElUhmxqaHY1xw4o1envdUf0+urOqHPqYN cJV05IuEiHVycXBeUqChKrCSr4yvlyPwKhUCP8lXpGET9Dkv9yRpPJ6fzmGQAn+K7obw gHgTuhGE8QYecUPuFARjQRgaBtW4MWDdS9Vug4l6b70GWRKVixj66WQARewd7eL3KYWn CqkhdtHEuHIy7RWnBtcBFnE/TbvayF69uLC2F4CZ4kOmh9RcqbpSYcVqOaQUrdaiU6sp Zqz6RgpXjCoczLMUH4nA/HptzDw3CPN5cnCrOUDstXB9GG34OxBOFWVA9uWxMeZPkZGe RPxg== X-Gm-Message-State: AOJu0Yz+AHiMMMmMCkQ6FKYF+Fl42eDAz3DS2oKs5en3v6SA4z0oCSVr DuDQgsLys7KoncAKBjjLRFyv7oTCbKf+gNmUj3rVBlZdRbEN9RpbSOjUt+BIRi/awadr8SyAJyA g X-Received: by 2002:a05:600c:3b20:b0:431:5a93:4e3c with SMTP id 5b1f17b1804b1-432df74cdb3mr117437165e9.16.1731934028473; Mon, 18 Nov 2024 04:47:08 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbe7dfsm12533069f8f.56.2024.11.18.04.47.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Dmitry Osipenko , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= Subject: [PULL 04/15] hw/display: factor out the scanout blob to fb conversion Date: Mon, 18 Nov 2024 13:46:31 +0100 Message-ID: <20241118124643.6958-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée There are two identical sequences of a code doing the same thing that raise warnings with Coverity. Before fixing those issues lets factor out the common code into a helper function we can share. Signed-off-by: Alex Bennée Cc: Dmitry Osipenko Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Message-ID: <20241111230040.68470-2-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/virtio/virtio-gpu.h | 15 +++++++++ hw/display/virtio-gpu-virgl.c | 22 +------------ hw/display/virtio-gpu.c | 60 +++++++++++++++++++++------------- 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 553799b8cc..924eb8737e 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -333,6 +333,21 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, struct virtio_gpu_scanout *s, uint32_t resource_id); +/** + * virtio_gpu_scanout_blob_to_fb() - fill out fb based on scanout data + * fb: the frame-buffer descriptor to fill out + * ss: the scanout blob data + * blob_size: size of scanout blob data + * + * This will check we have enough space for the frame taking into + * account that stride for all but the last line. + * + * Returns true on success, otherwise logs guest error and returns false + */ +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size); + /* virtio-gpu-udmabuf.c */ bool virtio_gpu_have_udmabuf(void); void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res); diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index eedae7357f..145a0b3879 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -805,7 +805,6 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_framebuffer fb = { 0 }; struct virtio_gpu_virgl_resource *res; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -852,26 +851,7 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, return; } - fb.format = virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: pixel format not supported %d\n", - __func__, ss.format); - cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width = ss.width; - fb.height = ss.height; - fb.stride = ss.strides[0]; - fb.offset = ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.stride; - - fbend = fb.offset; - fbend += fb.stride * (ss.r.height - 1); - fbend += fb.bytes_pp * ss.r.width; - if (fbend > res->base.blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->base.blob_size)) { cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c0570ef856..e7ca8fd1cf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -721,13 +721,48 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, &fb, res, &ss.r, &cmd->error); } +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size) +{ + uint64_t fbend; + + fb->format = virtio_gpu_get_pixman_format(ss->format); + if (!fb->format) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: host couldn't handle guest format %d\n", + __func__, ss->format); + return false; + } + + fb->bytes_pp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb->format), 8); + fb->width = ss->width; + fb->height = ss->height; + fb->stride = ss->strides[0]; + fb->offset = ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb->stride; + + fbend = fb->offset; + fbend += fb->stride * (ss->r.height - 1); + fbend += fb->bytes_pp * ss->r.width; + + if (fbend > blob_size) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: fb end out of range\n", + __func__); + return false; + } + + return true; +} + + + static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_simple_resource *res; struct virtio_gpu_framebuffer fb = { 0 }; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -753,28 +788,7 @@ static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, return; } - fb.format = virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: host couldn't handle guest format %d\n", - __func__, ss.format); - cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp = DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width = ss.width; - fb.height = ss.height; - fb.stride = ss.strides[0]; - fb.offset = ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.stride; - - fbend = fb.offset; - fbend += fb.stride * (ss.r.height - 1); - fbend += fb.bytes_pp * ss.r.width; - if (fbend > res->blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->blob_size)) { cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } From patchwork Mon Nov 18 12:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844086 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595332wrx; Mon, 18 Nov 2024 04:48:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUT4ehb3IT8YUdOwq7HJRxOFXGzKcuw5rVTTR1gCKRFrl0ha5ApU6PaFQSeeoUNVJIjF+gQug==@linaro.org X-Google-Smtp-Source: AGHT+IHcE/nzfp4faqgj6I4Mu0xuIh2ZEGmTa7r0l5b5e81jeCBq61+itzdF8tHBLISjT6Irugsf X-Received: by 2002:a05:622a:188c:b0:461:52b3:7ce5 with SMTP id d75a77b69052e-46363e970bemr179773481cf.37.1731934133399; Mon, 18 Nov 2024 04:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934133; cv=none; d=google.com; s=arc-20240605; b=Httee/3xvagsvtOX32cWUwwdlC6565Gs0XB/4MazSU1FvDjSrDZvZq+aW0RH2sUBln oBpn6N0Kwc7u676T0btpj3cpi4kHzsrjeeLiVYRPp+AzTcw3TpN4+xdpQ4rAK8kMTDZV F9zqKsYzi2AZzb7oB5bnodpDI5CLfZr2gDOcfEgtNo19fsM2H13HW8RmMklfB/VE9Jjs UmeQlZfw7gVrLkM03nzlbyxs1pz2iu216QnFdyardrmh+wL4x7of5sQAiX5RTUDndYZ2 g0ahrZQycrryOd+7iuYxS7GyQE4PmPnAzavNa7CC1RSI4rgK8IjvHQAHAYaBk7298eG4 Nm4Q== 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=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; fh=Rd6L/sBFZKAs+7WmvdDGFhm2efHDi0nixzl4z8FARRs=; b=HjdHiFE4ZPQcWOaKVjbANNoSm7ZeuFqJz7bDhRjpSRmvPiWYz5+eQ4Q/yWW22/fqdf o9WXFeIyVnTRm9IRoSYZiFTfNwNv4hMsWulKC/edh+9nt2uSo1eSk+PVFvCJy6EJbkX2 pU/IhrDPGOYCckaXiD8u8RNtysgkJCBWzOtCSNAazbI8/vGaeWwaJLp/3YrpbYo/t1TP gFm88qtbvyX3aqEsG5M7Qh1uq6O9mz/vigU/IvYDxHWqaG74PMx2d+Cc1iFZH3s24EtG 5suOcvEm2T5qeOJvchRF+eSJkZMGsfiO8iLEoX2Z9ZlEAAMiwCgOYilSoB27OzMbW59H n7dA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qH3ksDh8; 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 d75a77b69052e-4635a987252si101571801cf.102.2024.11.18.04.48.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:53 -0800 (PST) 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=qH3ksDh8; 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 1tD1A0-00037i-24; Mon, 18 Nov 2024 07:47:20 -0500 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 1tD19x-00036l-Mg for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:17 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19w-0005Oi-3c for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:17 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3823cf963f1so992643f8f.1 for ; Mon, 18 Nov 2024 04:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934034; x=1732538834; 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=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; b=qH3ksDh8AOeUFeTRRfg6RyCDwV92sxwPTl5zouS+2a8tGfTq94nVl2O064Dky83hCH HJNyf3LrghGxhO8jRU+MhNLtrWFN2swPYCxrU6TWUrRxVGy9TrivOIvwcVWDr0jVONYq bT5abUKR8M5TfAdLFa9WMmsieCYPS85QhYgJjdLvQA3jh8cVDlriRm8SPYlREx1lepO2 IFRb79IA4HR0Rww7Ah70BYWWbQ3u+hMHyfHla9ju3eyfzh/qQIT8nM/QTSrJqdr8z8eo +StbxY1awK9GJZrq2YarU1wAhYE9aHp+4HoDbX3XXhqhwlv5hUSjn1Ab190TkUkgY413 ODdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934034; x=1732538834; 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=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; b=OY0CxyvM6Z/mSHZhGkDd5fiq0kptX6j9FPKXgjzOeoHPU1GfU8+DzmfjN8BxKBwzbD liu9Et/Akcq9fsyTytGjdBWNXcd5PcgkYjky1OQ18f50PIdcj1/cAg5A/6B4oVl9Nm9p ogMhngqlJBwGJezKI2Fm2W3/3JcqOQc1G1bJZ+i0nBF69zA6xKZKbZVToBACiYab+ytt TsDUM5oSmX0YV/L3baEq7M6ELcVFYmvIwfDEI1LUWEc1pTQcSUZC0uA0jdNbnIMnI/Ha 08EG7oTr62jOVpAb8tK6Nc/2AthK3CGz+Nllfos1vNjY2AQSLMQRvwJzvUcMqm1Zoy9l Ks0A== X-Gm-Message-State: AOJu0Yx7nOTPy147JhIEmkPr5RbQ0Mf4z9F3++HUchf3m/6L7oC3SXD9 tWB+3D31fZxc4CKgx9RwTo+PKwUgFNjAkdBMdxnaFB0nRCnFiJ27Lz+mSnRYeiR2w20Amw+2XQY d X-Received: by 2002:a5d:5c0e:0:b0:382:4a4e:25bb with SMTP id ffacd0b85a97d-3824a4e2883mr1474474f8f.46.1731934034135; Mon, 18 Nov 2024 04:47:14 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38244355924sm4098904f8f.46.2024.11.18.04.47.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Dmitry Osipenko , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= Subject: [PULL 05/15] hw/display: check frame buffer can hold blob Date: Mon, 18 Nov 2024 13:46:32 +0100 Message-ID: <20241118124643.6958-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée Coverity reports (CID 1564769, 1564770) that we potentially overflow by doing some 32x32 multiplies for something that ends up in a 64 bit value. Fix this by first using stride for all lines and casting input to uint64_t to ensure a 64 bit multiply is used. Signed-off-by: Alex Bennée Cc: Dmitry Osipenko Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Message-ID: <20241111230040.68470-3-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/virtio/virtio-gpu.h | 2 +- hw/display/virtio-gpu.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 924eb8737e..8c977beebd 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -340,7 +340,7 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, * blob_size: size of scanout blob data * * This will check we have enough space for the frame taking into - * account that stride for all but the last line. + * account that stride. * * Returns true on success, otherwise logs guest error and returns false */ diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e7ca8fd1cf..7d22d03bbf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -742,8 +742,7 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, fb->offset = ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb->stride; fbend = fb->offset; - fbend += fb->stride * (ss->r.height - 1); - fbend += fb->bytes_pp * ss->r.width; + fbend += (uint64_t) fb->stride * ss->r.height; if (fbend > blob_size) { qemu_log_mask(LOG_GUEST_ERROR, From patchwork Mon Nov 18 12:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844083 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595136wrx; Mon, 18 Nov 2024 04:48:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVAPFuTwqrA6KlUbHNhuH1jHJO4TBRs+5OX0s4XmBGjdp413HEjCs/C6so3rY/XEKewwNDy3Q==@linaro.org X-Google-Smtp-Source: AGHT+IF5kuBlLZFgdizQSKULbK6sF2pmAQO1c9BtVJ6vqu/u9KwzkpBXivCnjsgtg619sEuHbFz6 X-Received: by 2002:a05:6358:728d:b0:1c3:8f64:add6 with SMTP id e5c5f4694b2df-1c6cd0a32fcmr345849955d.3.1731934103772; Mon, 18 Nov 2024 04:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934103; cv=none; d=google.com; s=arc-20240605; b=SpoGuEnNXVlWUD9o0+Er4s8WFlvoG9BVdzmTJzz0TAsWgJ3hWb6+4zFnjGHWCa1DO4 BYYhFOkRaqtAcbzCdnq0UWrdHoNpa546XpaX9aQtxRlKsKg1PkT8LVazHUH2/hLRrO+O Tm6FqFPvykLRT/lR+7V5Q96xkWjqR2XH9N5inrYVJoeaWkanaZEq3IzS6QwZ+Ybuq/F3 3HlX3FqmvyJWbI2A4HKlRgUyKkbdvz7TZaYUM9J4qJb5Bqgt29voYjlCtdQ282LqoJKz hXj23xuqsq4IbZKUgbw+7q5u/1Gu9RxlELMBulimySIUZ2d9EtB3JUUtA6M2dVIC7FuY sEMA== 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=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; fh=SqQlQHmMLZa3abQJDgRPtoEwUm91E14HsO+Ry39+EhE=; b=AJG0RO/rpSXnjI84zcWK9JMXbfCqTvFTG4s5izaXLHcYaxBadZp7YvVCiE1S8EktlJ k9JTHn8GQ+bMhCLY9QIL0MzVLpuxCqEbMp7OERsqiCcASt3IpZmrNMBEK3mITFLLzdZ0 V/2Fp1+2FF1bVJNOPksnJXtX2v4x/TzQz1SlcOJR8EyIJKgjN9SSHqPouhfa34g4yDmt +wriEr/ORgtmqMJTvSbe0bkVdOEMxJQcF8q2r5Ry4RmXsfMRbSm4VBICD8BXKuofJ8hg DALkCBCkZN5I1w3b7M/7tVXMfBupSrFkrFocd0sAlG1gh9QswuupH8yI9rt6v4x5QBCQ 2iCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=puz44dus; 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 d75a77b69052e-4635a9c83ddsi106051381cf.211.2024.11.18.04.48.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:23 -0800 (PST) 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=puz44dus; 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 1tD1A7-0003JX-K5; Mon, 18 Nov 2024 07:47:28 -0500 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 1tD1A3-0003CF-1X for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:23 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1A1-0005P0-Jn for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:22 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-382423f4082so929280f8f.3 for ; Mon, 18 Nov 2024 04:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934040; x=1732538840; 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=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; b=puz44dusnzUY4XWwEPc+Kz9e9ANwZ96rSmdjDJn5pSjG+JGPgscD7ICkeSGALgrlaK H7Ydl/0M+QgUJTDXK/QplIbJ+pwC6TROJk5z6QBphJSlJbBTpVuwNzJSb2ZA6oB4LeCB Z55xk6AHnAtFZyMbXywH+nBq9CEVfAc3jNMbWKPh2naUKWwH8Ids11IyXtLuz4SiiEsj p5qtb2cTeUGXkM5zxXmlcRcPlRPyTJEbnNxHL2sIWY/xph8fTZeyEuWYyQWMCll4kJOp XCSeM3Bn5qdfte6na/XwqTJH+uQj+Yu6FTL88kN32/Ndn9+N5FgtEDXN23pgnaNymLcd t5og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934040; x=1732538840; 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=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; b=rtz2wzAcWdBSyoiPYMv8o3UJCej27l8Po+V8xZ84Bab30QGV9KhrErkun16HuVxudI ZZyGoE1Brd8TR7wChXOFKG9TW6gxoHfNPucwPGv93z4V1qE2HhiyyoehphxmXygXq9LC 6Yx7LpfrBvxEhr8qCHIxS6o5c2SlwvbyHsDKuPAdrUx6yp6Hq+cLKd8AJWPNKs8klwbS v9zb6Lb2t5Q1blcMmKB665UMgb7yD+VDspRq4XBk1kJUiNiNKYSUoj3xrUO6dI4HlYtk HiN4Zh/yM5b14TVbj4C0bYiAeaJWiplemQpai4zOsRiWIcNy7ZWMbRJ4b76+c58g53uG 23yA== X-Gm-Message-State: AOJu0Yz0aXIncL33aLAH1kbYFiOFdp/oYuULiJNLbA6Rr50Z1ZLqLUsm ONmICPtCL+Fy7bo5ycMn0E/ouxc8gtHvg/ZMTMb6F3bDRATMIyzRsg3w/csRi8Rh0VpnRDxHjAN V X-Received: by 2002:a5d:47ab:0:b0:382:3789:191c with SMTP id ffacd0b85a97d-38237891a14mr6122659f8f.7.1731934039822; Mon, 18 Nov 2024 04:47:19 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3822e65cbdasm9119775f8f.7.2024.11.18.04.47.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zhang Chen , Li Zhijian , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/15] MAINTAINERS: Update my email address for COLO Date: Mon, 18 Nov 2024 13:46:33 +0100 Message-ID: <20241118124643.6958-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Zhang Chen Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian Message-ID: <20241112084038.6352-1-chen.zhang@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 095420f8b0..3f10529d9c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3559,7 +3559,7 @@ F: include/migration/failover.h F: docs/COLO-FT.txt COLO Proxy -M: Zhang Chen +M: Zhang Chen M: Li Zhijian S: Supported F: docs/colo-proxy.txt From patchwork Mon Nov 18 12:46:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844091 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595881wrx; Mon, 18 Nov 2024 04:50:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXjRnChf3mH6O2bNSCpgay1O4k3e/Rd34Q4+E9H4amP3MDid0iaZl5PMT2GFxi6MZ1tf5Q63w==@linaro.org X-Google-Smtp-Source: AGHT+IGcbRufTln1r00eaIwTtfNugKWCOo7A0xjnFzxmqbW2PBsFowrKoxg+d+DHW4hhIslUozmL X-Received: by 2002:a05:622a:5797:b0:461:2231:e01a with SMTP id d75a77b69052e-46363e24d20mr178504501cf.32.1731934214306; Mon, 18 Nov 2024 04:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934214; cv=none; d=google.com; s=arc-20240605; b=OhBkGTgsYyCww0DS0kcYmgPdVLE1/SOHlHZAmjizUb2HuTrKw3IH7PgIY/TwMsuh13 Jab76CcglRph2ryex1Wu4Lq36Hgc7YzErj30JozGYjBqOaJX84BHNI23Bu+fbvjjmUOA zXWKhtjyanaixcbtvrRrb/z1SZZPAWVPUZdp0U2SwL9AX8rJgjCrOyOsCrk85DeD6sNC 1Vm76CfHsU35TtdslCQ7V7bjwIKQZjdvLs5QvdAhVf+XCXR/pPQZPvcypRQ7D+dDvnws gUvZPjSrXiF0eIebBE+kOsZrfGC6vLUQE86OnR6zmvGlPIT+A/kZibFP1z+oTcEFvhyV /WoQ== 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=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; fh=Zw+4sAAE01oK7i9d0GhfdbGkPBrXvFlkfuHUwcTkHUg=; b=Zpqe2k9Ep+H1lrcoz9hBdgURj3jWjZQ9GMakv+4G5ezUnWSJtX5ru/Ub+oO2KaReHp FgLd4qL+EVUIKFSS6XkUutH52/m4H/+M+2ZCjHCDKUjzQo4Htp4yRk0sPZQIdec7uvuN hrD9p1HbIYAJ8kGm5UwLOwxVzPBi6b6LP3OAfkd5AJ0IEjs3R7BI2vITAUFjEUXK/kWD dZnH0vkNqVGrSYChAAWFJgtEvEDrWDun2wVy1DiFT+HrznxlBEPz1B81bNnmPwT2Ep1M YnXT+qW5jQvRE1jOFN02RnBGwlKvJMPEMu9pC8OZkpwA+M7OrYpD+FK3py4bMEhQC/my sNmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XIOrZcik; 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 d75a77b69052e-4636188999dsi93295751cf.255.2024.11.18.04.50.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:50:14 -0800 (PST) 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=XIOrZcik; 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 1tD1AA-0003Pw-O3; Mon, 18 Nov 2024 07:47:30 -0500 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 1tD1A9-0003Mt-EV for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:29 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1A7-0005PW-VK for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:29 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so26875775e9.2 for ; Mon, 18 Nov 2024 04:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934045; x=1732538845; 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=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; b=XIOrZcikEyo//fXKLMdc/8TV6ZB289n+ijbbARZmvjBY8HLl9cWGgfqA8MqpUGge+d 3E7Dnx44UIEtcYgKLLjDf5LkVq+mcfM/0hrJ6jMjZwD1womkQcTvYi9zCz3/X24ldNE6 W5mrMgMA+G2TRJpw9zX2pu5JGnZS4vBMXg6zgwulRSHQO6dec2PJPGd8kAJnHH/ygtT/ VG1bUgbfQk6f/J/CGYBCPdapHGbNr6W3dCF4/t5Oy2LHrHDZD/qhaLZMnW/czhi4uOOn YdsQO6wWCdQSrbvRUf1hOznBSVpTPviLL5SP4/BIYxEdlyEDUbQpGeFcV8IMtJQ3mG3g n6zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934045; x=1732538845; 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=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; b=gXf15XR05s6fXwYmJr+d0m9URI93OIL8tPUz5jxWGU5Kv+ItdzqLujkF8ZztNMs99R LES5KL53WCfF40NLjoA1CrUZX6Zu5Hytp5waggdl1DwlH8kK7Ga38V6E7MJLM6ILx/G7 GoUER7IbYJ5ye4fCAW5pKBA3CZrhmCF2sPGCEJF3L3mVigxuw3QAOUEyduQatBmiRlb8 6diMy7cAmSAx765y04h9ox3b1KYAScmWQlUibpgNjThN5+wnuPV3MIWWTsQnLhDBhTw3 Y+e5p/Isdb4JfydyxA27Xv+L+LW909S5LZepss+uN1UZD3P2mGVAS8+vF53bifDCokJS noxA== X-Gm-Message-State: AOJu0Yz8BkFLBUgJiG3d+TELKOKjJ1sPP/dLBn/9IVX+osBGTR8Znqsn mMtcLYDW54qzE9bqSKBlJL5KsbrQaq26pu/Nv2V4n8tNh9v3OnK3K1yOShU3RItuJDp0btwIuU0 n X-Received: by 2002:a05:600c:1908:b0:431:52da:9d67 with SMTP id 5b1f17b1804b1-432df7178f9mr114301385e9.3.1731934045442; Mon, 18 Nov 2024 04:47:25 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab78783sm154194365e9.12.2024.11.18.04.47.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Guenter Roeck , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 07/15] usb-hub: Fix handling port power control messages Date: Mon, 18 Nov 2024 13:46:34 +0100 Message-ID: <20241118124643.6958-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Guenter Roeck The ClearPortFeature control message fails for PORT_POWER because there is no break; at the end of the case statement, causing it to fall through to the failure handler. Add the missing break; to solve the problem. Fixes: 1cc403eb21 ("usb-hub: emulate per port power switching") Signed-off-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241112170152.217664-11-linux@roeck-us.net> Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/dev-hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 06e9537d03..2c3640c705 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -479,6 +479,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, usb_hub_port_clear(port, PORT_STAT_SUSPEND); port->wPortChange = 0; } + break; default: goto fail; } From patchwork Mon Nov 18 12:46:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844085 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595327wrx; Mon, 18 Nov 2024 04:48:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWsXOM5IE2H990Oiqo4hFgwJwAlSm82nfSvR/lUBrcG1nzWy0/xHMPgoaxf8Nf2YATQ8gX5dw==@linaro.org X-Google-Smtp-Source: AGHT+IGxwTdWOW5bJQZEDNEqUhTYnwBLiVm26tl1epxud1gxEvIhG82DXSaS0Cdm2vwRNQmKCi33 X-Received: by 2002:a05:6902:2b86:b0:e35:d93a:c9bb with SMTP id 3f1490d57ef6-e382612924cmr9374530276.10.1731934132534; Mon, 18 Nov 2024 04:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934132; cv=none; d=google.com; s=arc-20240605; b=WPtbo2s9UzDvBOKXlDiyyJHI5bHcIzmbpyksHwogOpq/P9t0+GZV8pZEApuWzxSlc1 2bJg+A+6IMfLYWr/z2S0MyCPd59RjzejLQ+fJo/bSqUOnpPuC/LogG03gMVJ62ACkx5n CqFaUJEvFaC+7vIdIVCLM2yVjK0jEbnlgWM+uEBoY1s+eZqs7V+CBq+1IH3C8hpd3CnF 5KCgpeG89ogSDs9kOxEQ2pyPqtfkWuXcdnhqmH0p/2tmxNUyaxK8PMfxRG4Ze0kBDFMX yl2sH6cxbfUbMKrauXp97xdroFCFeQH1G6fmCSeuCC18MI78BB2Mmf7Oy2b5VJDySgN8 1Tkg== 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=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; fh=zszqSPu/qlmUuKQi/9kIpLaH8aRjWw2EMzgpgMkmYxY=; b=WWbyEhba8AQgWLCX4GhpUt1QdXMgtNNTm41L+nZLuahHl1qTMU6dkoRW3n187OsxzQ JC0odoAovwFkj91sVR5Jqm5Sx11VRZ8251AByIH+uk5AXlvaOeJmii2PABodFks8gZux f6NXg453n4K86Njc7nm+/FUjv07E/obmxA2SP8r/uqb/+QnbE3lHdbUACHx3mFa8nGIE RUzQdYP6fd7n3tpp3tlc6Iq4ccTSTjxB0OtVYTKFurtg30rNJe4vSpRy6JC0DFlVgRY7 W6D4aQInagMXdIL+loCL0Z82lCGWAADglh/ri9oJQR7dIJPpgv9oWP8SVyFrP6WW2bxt cfkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uYEBMIHE; 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 6a1803df08f44-6d40db71419si64723716d6.93.2024.11.18.04.48.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:52 -0800 (PST) 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=uYEBMIHE; 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 1tD1AG-0003UJ-Ib; Mon, 18 Nov 2024 07:47:36 -0500 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 1tD1AE-0003Si-Sj for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:34 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AC-0005Pw-VF for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:34 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so27000355e9.0 for ; Mon, 18 Nov 2024 04:47:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934051; x=1732538851; 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=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; b=uYEBMIHEMQEEIdZ5D3rDFeJWfwsbprukgS6QlltSEYXJgdBIpESIQ4a8PD7HiTNJHE CDlBLEboT2jrbBrPHz0kiJK5UdKIbZXKqAaln35j7jbEuEcpAEP0ofgpWcUAa47pNrpU d0ZYP0ZUQNxhWw8OvlT3iEIpGpvwjL2eN7QX/oU8JzdiG+mIqnvGxTVBpEPyA57d6TkE 8NZmJWpylfUIRcyYeBzNe93eUmPuYs++uIylCMHykMYBaAqhfPpSYgrfVguwRUzIRcnH 8QC+ZyhAT31WO1cIrQNAsODEMjDDLtP2HhHsj1fsbsQs0caJSyY9HzMoJ8u4Ifua+Af7 rODg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934051; x=1732538851; 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=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; b=wdLJT4PKevbFq2fRniej1YjTSiNP07WghEOXyySF+Es35aQft6iUToH9xTvYivJTf1 uRjGo2kNOgGwGK6+guTs374y6gbVOtvHrzsJP10Bf7Xl/4YTu4Uo+aeSTS1sAWV540pU YsVFvmY7ArNrhxlSR8tD4AX+4DrS7JAQNXabeLTutz7C0Jsyvhir++8GsMcAYuxX01T/ WrjIiUpcgBy6oV7HSswaHojcIuF1XfkLGxFkW/njv/TNF8p5s61+6g7F7xv33IFDe8eG WDRT++OuoDzcxFkbQzccpv3SqqgIzulhE3VlVS57PxxQSdpwTQKvlMRzFMkjhumJKsj7 Dnzg== X-Gm-Message-State: AOJu0Yx7a5YsaJEhtEmalwzbRYeGaKUX3wQSiDqWUmXXDVce0vFopoIL khJBJZyQd2kKxIMkDry/AvXvZ+FVBV/ognvXTl0yHcpuWd6Hqn3lqtQeqBm9WpP0Sy85ehxNyQ0 0 X-Received: by 2002:a05:600c:3ba7:b0:42c:b52b:4335 with SMTP id 5b1f17b1804b1-432df725265mr118347755e9.10.1731934051088; Mon, 18 Nov 2024 04:47:31 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da244cb6sm161586485e9.0.2024.11.18.04.47.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fabiano Rosas , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Subject: [PULL 08/15] tests/qtest/migration: Fix indentations Date: Mon, 18 Nov 2024 13:46:35 +0100 Message-ID: <20241118124643.6958-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Fabiano Rosas Select all the code and hit tab. I'll be moving functions around quite a lot in the next patches, so make sure all indentation is correct now. Add parentheses around some expressions to preserve readability. Reviewed-by: Daniel P. Berrangé Signed-off-by: Fabiano Rosas Message-ID: <20241113194630.3385-2-farosas@suse.de> Signed-off-by: Philippe Mathieu-Daudé --- tests/qtest/migration-helpers.c | 4 +-- tests/qtest/migration-test.c | 59 ++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index 0025933883..3f8ba7fa8e 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -140,8 +140,8 @@ static void migrate_set_ports(QTestState *to, QList *channel_list) if (qdict_haskey(addrdict, "port") && qdict_haskey(addr, "port") && (strcmp(qdict_get_str(addrdict, "port"), "0") == 0)) { - addr_port = qdict_get_str(addr, "port"); - qdict_put_str(addrdict, "port", addr_port); + addr_port = qdict_get_str(addr, "port"); + qdict_put_str(addrdict, "port", addr_port); } } diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e6a2803e71..74d3000198 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -113,8 +113,8 @@ static bool ufd_version_check(void) } uffd_feature_thread_id = api_struct.features & UFFD_FEATURE_THREAD_ID; - ioctl_mask = 1ULL << _UFFDIO_REGISTER | - 1ULL << _UFFDIO_UNREGISTER; + ioctl_mask = (1ULL << _UFFDIO_REGISTER | + 1ULL << _UFFDIO_UNREGISTER); if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) { g_test_message("Skipping test: Missing userfault feature"); return false; @@ -423,7 +423,7 @@ static void migrate_set_parameter_str(QTestState *who, const char *parameter, } static long long migrate_get_parameter_bool(QTestState *who, - const char *parameter) + const char *parameter) { QDict *rsp; int result; @@ -436,7 +436,7 @@ static long long migrate_get_parameter_bool(QTestState *who, } static void migrate_check_parameter_bool(QTestState *who, const char *parameter, - int value) + int value) { int result; @@ -445,7 +445,7 @@ static void migrate_check_parameter_bool(QTestState *who, const char *parameter, } static void migrate_set_parameter_bool(QTestState *who, const char *parameter, - int value) + int value) { qtest_qmp_assert_success(who, "{ 'execute': 'migrate-set-parameters'," @@ -1384,8 +1384,10 @@ static void test_postcopy_preempt_tls_psk(void) static void wait_for_postcopy_status(QTestState *one, const char *status) { wait_for_migration_status(one, status, - (const char * []) { "failed", "active", - "completed", NULL }); + (const char * []) { + "failed", "active", + "completed", NULL + }); } static void postcopy_recover_fail(QTestState *from, QTestState *to, @@ -2575,15 +2577,17 @@ static void test_migrate_fd_finish_hook(QTestState *from, /* Test closing fds */ /* We assume, that QEMU removes named fd from its list, * so this should fail */ - rsp = qtest_qmp(from, "{ 'execute': 'closefd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); + rsp = qtest_qmp(from, + "{ 'execute': 'closefd'," + " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found"); qobject_unref(rsp); - rsp = qtest_qmp(to, "{ 'execute': 'closefd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); + rsp = qtest_qmp(to, + "{ 'execute': 'closefd'," + " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc = qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, ==, "File descriptor named 'fd-mig' not found"); @@ -2741,11 +2745,11 @@ static void test_validate_uri_channels_both_set(void) }, .listen_uri = "defer", .connect_uri = "tcp:127.0.0.1:0", - .connect_channels = "[ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]", + .connect_channels = ("[ { ""'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), }; do_test_validate_uri_channel(&args); @@ -2967,7 +2971,7 @@ test_migrate_precopy_tcp_multifd_qatzip_start(QTestState *from, #ifdef CONFIG_QPL static void * test_migrate_precopy_tcp_multifd_qpl_start(QTestState *from, - QTestState *to) + QTestState *to) { return test_migrate_precopy_tcp_multifd_start_common(from, to, "qpl"); } @@ -3032,11 +3036,11 @@ static void test_multifd_tcp_channels_none(void) .listen_uri = "defer", .start_hook = test_migrate_precopy_tcp_multifd_start, .live = true, - .connect_channels = "[ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]", + .connect_channels = ("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), }; test_precopy_common(&args); } @@ -3668,7 +3672,8 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full = 0; while (throttle_us_per_full == 0) { throttle_us_per_full = - read_migrate_property_int(from, "dirty-limit-throttle-time-per-round"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round"); usleep(100); g_assert_false(src_state.stop_seen); } @@ -3680,7 +3685,8 @@ static void test_migrate_dirty_limit(void) /* Check if dirty limit throttle switched off, set timeout 1ms */ do { throttle_us_per_full = - read_migrate_property_int(from, "dirty-limit-throttle-time-per-round"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round"); usleep(100); g_assert_false(src_state.stop_seen); } while (throttle_us_per_full != 0 && --max_try_count); @@ -3709,7 +3715,8 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full = 0; while (throttle_us_per_full == 0) { throttle_us_per_full = - read_migrate_property_int(from, "dirty-limit-throttle-time-per-round"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round"); usleep(100); g_assert_false(src_state.stop_seen); } @@ -3989,7 +3996,7 @@ int main(int argc, char **argv) #endif #ifdef CONFIG_QATZIP migration_test_add("/migration/multifd/tcp/plain/qatzip", - test_multifd_tcp_qatzip); + test_multifd_tcp_qatzip); #endif #ifdef CONFIG_QPL migration_test_add("/migration/multifd/tcp/plain/qpl", From patchwork Mon Nov 18 12:46:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844092 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp596040wrx; Mon, 18 Nov 2024 04:50:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXYIb/azRDag0sCyMzrhGtyo+5/qeUw++v29GojIi3j80tNnBmlY7T9RAkXDmGxcSU5X9EYJQ==@linaro.org X-Google-Smtp-Source: AGHT+IH2f4jy4tDS+eR+pZ8a+BqVJZOJDaJ0Lbqy7tHeNk2HywC8vBNONU1RBG5rCUMQPNMQJRhX X-Received: by 2002:a05:6359:1906:b0:1c5:e2eb:5aad with SMTP id e5c5f4694b2df-1c6cd285172mr358418255d.20.1731934237511; Mon, 18 Nov 2024 04:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934237; cv=none; d=google.com; s=arc-20240605; b=WExV6WEi0vh1I1i0WwuE63A/un8H7IA67xpqp+zAjrnYIemuH+7h+tb8xAzRYe5SFU GLNRmZXBfLEgTzt0IbIssJpzeWUAoj5x5JzEZAAvFZRu0B5SMOfXkdjwwKRI3jwfAL8d evkDd55vXNw4dsEjlzhvu1i6gG3Btkbd2tlLXBQnNp7aKbbVJ6MKxqafc4+kbE0cMLAD xcG8FGhbAQFIBKczyRd0Ule15kF2ykoOq1U2fpFqB7WMcZsFRJv2qm0M3mVJpgYGxPwa 6ByQgm7Yt4uvo04TO3lmSHBAJ9nm73a8nrRFhx40FVWTb/Tse8UiXJkCQMHBa59gSjGe 4KXg== 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=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; fh=fJ6me+y9fL5bPoMrdJyLXetZZ3atLrhWCDtNpV0j8Uk=; b=MXGDrdZylE3osxZDqEYDWW+bns0oaRlJQ69tQ8UrdcB33zcyyhRllTag8Q31VaWF3j eePBDLL/1wEq5/VkfgR4RkjonvarN/Uus7MM+eL+5rzm916v+jcpoI+Mt7mTGZZimaWf akhGTdGa4p5p6u/J8iv2AuExFboMgU1/V1lEaLp0rbXjmStknzDOml9ShLgKhYxTgRjd 5UZhPVUGc+MFBN5g4AAlnNfgRXnVKL3eqOsFSjnHqu2NatAEup3Qv739inLqO+35bL76 ohwmkryzMLERrovT2duNpDz9FB1kFWpJ4yGmvEB382LuYmuYnq3kS1WtqZli7PLC/rcY CjjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q1bDQdYd; 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 d75a77b69052e-4635aad937asi102106901cf.363.2024.11.18.04.50.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:50:37 -0800 (PST) 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=q1bDQdYd; 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 1tD1AM-0003vN-PI; Mon, 18 Nov 2024 07:47:42 -0500 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 1tD1AL-0003pN-Cc for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:41 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AJ-0005QQ-2R for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:40 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43158625112so17935415e9.3 for ; Mon, 18 Nov 2024 04:47:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934057; x=1732538857; 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=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; b=q1bDQdYd1hFDMex44wN3IjKwShz0w+NbbHXstuu48clkx3A5r7FZBUL1Uudgo/WGoq ZTZKpFHiNHzLIAOfi3PyJ8Um5waflRvGNa0xK83qAfswL4YJTp57mOU2b10W3fIv7lMV YSVCGCrPyjxS9pL6EyTL+Aeua0PtctKlsii9sAJiSMQ0IAPYg7hExXxJRtUpGOeq+jJ8 YHI0ek6wOdrggeLI4KPc93KWALciKKoOguHBrmHWtA0CjC3pakMCEvzdkTCiIi8sMUZI aOzI4SZl0R1d8PubhpGl5WOHatJ5DHE3fD1inrXEWtHa9Ngu/Ot3vSj4hqz0PafQk9Q+ AvlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934057; x=1732538857; 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=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; b=TBC0YRIEa40KbTgQCyAo9BrxynraBodaj8DeoBl0zKcYLOEKIa3lhaQsE5BghK8TL9 1b3NUx3LjLOU7xoajNPj1bdh3rYZUTGJvPZ0SQpwsX7CH20ZNsyqN8XgLqNQoA3QZ0YR mcakYTqjI9gjWiO6+ugNfNaF40IGvq0QslkkD/CNJb6WXpkPireEy0/UW6TJLcGVRVMH 4+6Udgvku+zg/zov6PyCVDEr3uU+Hy0BUwDGxpsiv6x1COkzrpf+K8rx0+BAkfBxhcAa EJ/+fhXEYKye+Du4bu2vbosnnKowFiRJx0amOpnsoQ0b/O1UToImi0SZFEvUKbFV7ZUv xgoQ== X-Gm-Message-State: AOJu0YwSh+m7QwQFiGdaYdjI62TWIr8OtR4cpqjQtvLOHAFVkFnBvGWc DxsAADWH2HDAT4bwHXRBYxmijsAnGuU1BURpuXdqsWaLsFEHhlyGC+O/jKW+5NBiXSBFyldMt/o B X-Received: by 2002:a05:600c:1c23:b0:430:5846:7582 with SMTP id 5b1f17b1804b1-432df72069amr96237215e9.7.1731934056920; Mon, 18 Nov 2024 04:47:36 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da28b698sm157531375e9.27.2024.11.18.04.47.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jamin Lin , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PULL 09/15] hw/sd/sdhci: Fix coding style Date: Mon, 18 Nov 2024 13:46:36 +0100 Message-ID: <20241118124643.6958-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jamin Lin Fix coding style issues from checkpatch.pl Signed-off-by: Jamin Lin Reviewed-by: Cédric Le Goater Message-ID: <20241114094839.4128404-2-jamin_lin@aspeedtech.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 64 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index dbe5c2340c..37875c02c3 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -233,7 +233,7 @@ static void sdhci_raise_insertion_irq(void *opaque) if (s->norintsts & SDHC_NIS_REMOVE) { timer_mod(s->insert_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DELAY); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DELAY); } else { s->prnsts = 0x1ff0000; if (s->norintstsen & SDHC_NISEN_INSERT) { @@ -251,7 +251,7 @@ static void sdhci_set_inserted(DeviceState *dev, bool level) if ((s->norintsts & SDHC_NIS_REMOVE) && level) { /* Give target some time to notice card ejection */ timer_mod(s->insert_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DELAY); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DELAY); } else { if (level) { s->prnsts = 0x1ff0000; @@ -289,9 +289,11 @@ static void sdhci_reset(SDHCIState *s) timer_del(s->insert_timer); timer_del(s->transfer_timer); - /* Set all registers to 0. Capabilities/Version registers are not cleared + /* + * Set all registers to 0. Capabilities/Version registers are not cleared * and assumed to always preserve their value, given to them during - * initialization */ + * initialization + */ memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmasysad); /* Reset other state based on current card insertion/readonly status */ @@ -305,7 +307,8 @@ static void sdhci_reset(SDHCIState *s) static void sdhci_poweron_reset(DeviceState *dev) { - /* QOM (ie power-on) reset. This is identical to reset + /* + * QOM (ie power-on) reset. This is identical to reset * commanded via device register apart from handling of the * 'pending insert on powerup' quirk. */ @@ -445,8 +448,10 @@ static void sdhci_read_block_from_card(SDHCIState *s) s->prnsts &= ~SDHC_DAT_LINE_ACTIVE; } - /* If stop at block gap request was set and it's not the last block of - * data - generate Block Event interrupt */ + /* + * If stop at block gap request was set and it's not the last block of + * data - generate Block Event interrupt + */ if (s->stopped_state == sdhc_gap_read && (s->trnmod & SDHC_TRNS_MULTI) && s->blkcnt != 1) { s->prnsts &= ~SDHC_DAT_LINE_ACTIVE; @@ -548,8 +553,10 @@ static void sdhci_write_block_to_card(SDHCIState *s) sdhci_update_irq(s); } -/* Write @size bytes of @value data to host controller @s Buffer Data Port - * register */ +/* + * Write @size bytes of @value data to host controller @s Buffer Data Port + * register + */ static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size) { unsigned i; @@ -594,9 +601,11 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) return; } - /* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for + /* + * XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account for * possible stop at page boundary if initial address is not page aligned, - * allow them to work properly */ + * allow them to work properly + */ if ((s->sdmasysad % boundary_chk) == 0) { page_aligned = true; } @@ -702,7 +711,8 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr) dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2), MEMTXATTRS_UNSPECIFIED); adma2 = le64_to_cpu(adma2); - /* The spec does not specify endianness of descriptor table. + /* + * The spec does not specify endianness of descriptor table. * We currently assume that it is LE. */ dscr->addr = (hwaddr)extract64(adma2, 32, 32) & ~0x3ull; @@ -977,8 +987,10 @@ static bool sdhci_can_issue_command(SDHCIState *s) return true; } -/* The Buffer Data Port register must be accessed in sequential and - * continuous manner */ +/* + * The Buffer Data Port register must be accessed in sequential and + * continuous manner + */ static inline bool sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num) { @@ -1206,8 +1218,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) MASKED_WRITE(s->argument, mask, value); break; case SDHC_TRNMOD: - /* DMA can be enabled only if it is supported as indicated by - * capabilities register */ + /* + * DMA can be enabled only if it is supported as indicated by + * capabilities register + */ if (!(s->capareg & R_SDHC_CAPAB_SDMA_MASK)) { value &= ~SDHC_TRNS_DMA; } @@ -1279,8 +1293,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) } else { s->norintsts &= ~SDHC_NIS_ERR; } - /* Quirk for Raspberry Pi: pending card insert interrupt - * appears when first enabled after power on */ + /* + * Quirk for Raspberry Pi: pending card insert interrupt + * appears when first enabled after power on + */ if ((s->norintstsen & SDHC_NISEN_INSERT) && s->pending_insert_state) { assert(s->pending_insert_quirk); s->norintsts |= SDHC_NIS_INSERT; @@ -1396,8 +1412,10 @@ void sdhci_initfn(SDHCIState *s) { qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SDHCI_BUS, DEVICE(s), "sd-bus"); - s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s); - s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s); + s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, + sdhci_raise_insertion_irq, s); + s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, + sdhci_data_transfer, s); s->io_ops = &sdhci_mmio_le_ops; } @@ -1445,11 +1463,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp) void sdhci_common_unrealize(SDHCIState *s) { - /* This function is expected to be called only once for each class: + /* + * This function is expected to be called only once for each class: * - SysBus: via DeviceClass->unrealize(), * - PCI: via PCIDeviceClass->exit(). * However to avoid double-free and/or use-after-free we still nullify - * this variable (better safe than sorry!). */ + * this variable (better safe than sorry!). + */ g_free(s->fifo_buffer); s->fifo_buffer = NULL; } From patchwork Mon Nov 18 12:46:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844084 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595328wrx; Mon, 18 Nov 2024 04:48:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUOgAvFBW0Gp+8w5X3UOQIikwkbpSWXwwN2sFwnzY3M0pm34y6VI/XMKBWjqfkSBsxPZ+lYqw==@linaro.org X-Google-Smtp-Source: AGHT+IGbaTIDLFOzphraggATgber3X/8nKtzarYBPagjI0KnPLj/Zn+FvjrG2O0jk8ZFjLDIRcLj X-Received: by 2002:a05:690c:6013:b0:6ea:7b98:3a00 with SMTP id 00721157ae682-6ee55a72f75mr133613397b3.16.1731934132656; Mon, 18 Nov 2024 04:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934132; cv=none; d=google.com; s=arc-20240605; b=GqmuQqanyLy2+BRjaD2P1X3lEm33aLxPao7AIwxjOC9KdL2NP7iXNKflaEWORJGiNH DA47V1apablGQzBakNZN19cA9SBtTFkL74TJMUNL6wSr05Lp+Jt8jG4Wa/rskYY1AH8B X8uESGypb0MY37GGPACJ2xMR4DciMrFkejwd6MRJAwsYwVQXXZOi7vjl1N8j+i6LEZWx bM0TqA6A5f2OknTtyY8MMlag1agaKzlNy1IDVS4DSgT/TcYAt9VYqUsewzSVeOusUi3b 802TJDaEU33p5wuqx44sAAAf9AlTgEbaVMOr1d4K4G7bgXFer9ZDMAk1/616XsdzmczL e2wQ== 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=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; fh=8fYdrLYzrhnnVCkVX7NQA4cokHBXJN14ApGw6GpHeu0=; b=GuSRgjv+m2Zx9+D0utt1udeSiyP8HFjgoyjhyf6qvLzxML5SmUMMmmFBrEeGcCw4qI fYTlWueZ1jCeL0KDECy+W1QKMw3JploAC5CWL1mEm0ioUpxVCNpAsASm1JLeR7W/LxTR FZxq+9emfBLjIWatjZNn8OdQvI1/ajNvwbWjvelPfNEHVO+ziMWuf6GtjfLkOcypJLZR yCEHYbhxEQdJip6tt4vBei2Lh4qbzBxspiSKr/0VMFdkMmhTmYQxw/LyYRsDcoq+A6dI Vc4D8L5zA8OSoBqd6J465K95yRjQbGQmlsfLfewpd8DbMQ54UiOnnL7DQqjfOp2BTSjj FQGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LpJW46pf; 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 d75a77b69052e-4635aaeaf02si103252221cf.422.2024.11.18.04.48.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:52 -0800 (PST) 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=LpJW46pf; 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 1tD1BH-0004Y5-N9; Mon, 18 Nov 2024 07:48:42 -0500 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 1tD1AQ-00044y-Db for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:50 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AO-0005Qa-EZ for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4316cce103dso29026285e9.3 for ; Mon, 18 Nov 2024 04:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934062; x=1732538862; 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=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; b=LpJW46pfNKOoEuCQ/SIqWbD9LmiUwR4SSsLDLuSiHBIc2uzqC4PkR1Z6Aac+h/P39Y MQFS2zV11FjajsD7/67kohR8/eIz0fhsQNlOttKl79yaSRNM1lvp4XWJJDyVwKtOH8du NecVL4oRJbGikXFSysTFRADZFNiKHT4FE/BY4+tsRlo70DDr3UWCVamY98XPrjQ0rGwv V2A4hOF+WceYkTFk5tiohViCrDcn6HGJ6eq8IT2oOygYzK5MHg0EQq6WrZ9qUsRAFqrI 3xwy9wOLYIfXtivB9II3maOWxVbXEr3e0rRSfdEUiRINnBhKQy46WWaOIZXxn8vPZNUC HWvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934062; x=1732538862; 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=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; b=B/RCGupStOUq/ZHfE/uXmBBbpqpz7nHgKHfa20g7jSxm2fmi+BWyfl614eprWyyRDa cUDOrAmwY6oqMuRKONOW3ENGxk5DMIt3TJkJtN3UT5SwhunXSRThk3uoEGZ3TUjywVh3 rCA5ZJpGeJmFkelFeJ79bi8k6J4vfbu9zmg/Dz8luUpX+4kXt06LTY2B+BOHtvc8BNPv VKUhqj7DcMLBMk8v0TKRqXa9G7UfLoyIHxWqbY3HJMYhZ6iBIotuIhVg8PPbcNr8XxMK YLK0IuD+bSIHdZWFknivQVb/jxVxQgimfALyg/FKbyqGz/FxVlShCfT3617bLypv+gzS bLPQ== X-Gm-Message-State: AOJu0Yz8lR3OxbizO7DYBH2cUBlMwZ4ovksBSWpAc4ktaeZ0jWk6MvVk iwPnlgKvC5NdwDVm30p2wprJP9v/CXO/5HkvV6kYZmQEyZ2pex/1U8urV/GUM4RmARFqqJMzScP d X-Received: by 2002:a05:600c:1e18:b0:42c:a387:6a6f with SMTP id 5b1f17b1804b1-432df78f3c1mr121231735e9.20.1731934062603; Mon, 18 Nov 2024 04:47:42 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da244cb6sm161593995e9.0.2024.11.18.04.47.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Mark Cave-Ayland Subject: [PULL 10/15] hw/misc/mos6522: Fix bad class definition of the MOS6522 device Date: Mon, 18 Nov 2024 13:46:37 +0100 Message-ID: <20241118124643.6958-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Huth When compiling QEMU with --enable-cfi, the "q800" m68k machine currently crashes very early, when the q800_machine_init() function tries to wire the interrupts of the "via1" device. This happens because TYPE_MOS6522_Q800_VIA1 is supposed to be a proper SysBus device, but its parent (TYPE_MOS6522) has a mistake in its class definition where it is only derived from DeviceClass, and not from SysBusDeviceClass, so we end up in funny memory access issues here. Using the right class hierarchy for the MOS6522 device fixes the problem. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2675 Signed-off-by: Thomas Huth Fixes: 51f233ec92 ("misc: introduce new mos6522 VIA device") Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Message-ID: <20241114104653.963812-1-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/misc/mos6522.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h index fba45668ab..920871a598 100644 --- a/include/hw/misc/mos6522.h +++ b/include/hw/misc/mos6522.h @@ -154,7 +154,7 @@ struct MOS6522State { OBJECT_DECLARE_TYPE(MOS6522State, MOS6522DeviceClass, MOS6522) struct MOS6522DeviceClass { - DeviceClass parent_class; + SysBusDeviceClass parent_class; ResettablePhases parent_phases; void (*portB_write)(MOS6522State *dev); From patchwork Mon Nov 18 12:46:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844087 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595341wrx; Mon, 18 Nov 2024 04:48:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW6brjSCyYnJBoqBclMDaou1EhSpnpYiS0oZ2txFjMh0DM19K2QiZEXpcUS8gHyJu0D9g9sTQ==@linaro.org X-Google-Smtp-Source: AGHT+IEfJv8RYmUlL1pVOd+pNOruj2w9590X5eAWrla/GIRALq5x7GptyL8Vo/pzDVNkBdSm1Ixv X-Received: by 2002:a05:620a:2486:b0:7b1:8e09:512b with SMTP id af79cd13be357-7b3622e7f7cmr1816298785a.24.1731934134671; Mon, 18 Nov 2024 04:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934134; cv=none; d=google.com; s=arc-20240605; b=CmW3WawXxL08Ood27qIe4PeF4l0yacdj0eLths3nAz6f5pSf5jYmZz5D3GoL67ur80 asVzGIuJ5hq5qJURgkt/1TgztPGZketHlPlwfqABQrJvpacWL+e3jdh4/970KJP99wGC dJ6kuoUjZEPkfFma6l9I6fOI02gO8hxbsfqxSisJAL09/rdMKoux0tgCHb948XgrfVPY 3WcT5TvgI1uMdoan6LdJQadKBkSmwWK+9CPgrn5n3l9gH3jY2C+v26R03w0IrHH/ONa7 RuNJjBuk048IneJNvgaW4htXyzvPY9xbTKRrDiXvgX5lFTVmYvy+xBl1hrxRVoTpUrnt QLiA== 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=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; fh=qL0czp+eueBY7VUBTT/kKICzLrY+ihIcvjbbb0f0J3c=; b=jjKYqxH8vE4qPFn34USLymTaakGHOWGH+Z5MzRreTkTv3AEnUwxz1uEh2ZAGlB/27y P1k17sqeh/QzCuty5myQYCuu7RcvMH8T7Df9TuS3ghz29lBjVT1zWhgjK8KiRUU863XY 6QqcloNdSCnQ8qLCU+TbXZLlUkwtz/UdZzaReTQNnncEphrSJc65B0K8Oh1YwdPZ36op sxsG7BAiabTx4ahEebakGg/eeaW1DYXpPYIwqaP3vioPtzPD0IrC4Hhyw7zQF1GBYh1y kXWi2IzkvGTtAR5jiMMbpepNDug6Ligmr1wa1Rl+ZKyJAoOhpBBFfBBUlUcdwOmGF1zn DOgA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pQ+/tJor"; 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-7b35c992b60si1139763985a.198.2024.11.18.04.48.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:48:54 -0800 (PST) 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="pQ+/tJor"; 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 1tD1BO-0005KU-UK; Mon, 18 Nov 2024 07:48:47 -0500 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 1tD1AW-0004Aj-MM for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:02 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AU-0005R3-Fr for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:52 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-382456c6597so631276f8f.2 for ; Mon, 18 Nov 2024 04:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934068; x=1732538868; 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=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; b=pQ+/tJorJBOJQTGgvlAptHbcfivKLHWdsfa5HOcwJZ+jkrQAe2iZ/tR52yVT0X2yYH uSTKREnLtRFLLeQrzsDR68Nb5DQupuHreSdOaJVWsOMkRhAsKiKGxjNu97yUF2SAAfeu RHVcd9+CtI+jK/huCZ9vMgc2kUu5ZxAQeSybB22INUvi69XsAqTBvAVvnkq4tVpGC5Yu M/keS9WfW16GJg7f/DL4i8yXrq/OZivdx9RGHTIznftrcsY47GUZGmmKgOXP6S/iQwVd Jt6fLNd6Ge+x76W/qOUMu1JRKp4IQdoO49jDxMri1M73wsSpY1WRSXAQrT+RsnMRyGZH 2A4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934068; x=1732538868; 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=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; b=iFW/o6YBJfJTHd7okRYuW/7NMHWFCwYWsPwMD8TxpkZi+MK6jQeJgq7uLK98v1GZrY 44UarBUIS4UMI3C58JKuZJU6w5sfmbvcE44dT5Ei00ywL79ON/gBdRLOOeRPEvk5E7iD 5xVDoY0dys/Js9kP2Ff17zRafFGJ9ygtq+y3ji8rDI8dH9K+1bQWay9Le4hbUpYSIDIu gGS6UC8xWpzY4bUa/MvHwkAyPUMjFe8CF7k29vH6D76G1KBNhJ9NrSkHZ0auMivZlPvf JTA7BpGV3EWstd5OA6iSDwK3TGZw/YDUSqydXFCg+SXXqPpCR/gbvZt7bthSzUYX1C4/ TI0A== X-Gm-Message-State: AOJu0YzimiY4m404pWEgIJa1Qnus2btSzg/nsGMXvC5GQVz6Ot2L7+Qc L44nG6AaNVPSGHaSmT+yCdfLlO6WVZ5apggK7leOyrbbFPtVuGHGZHtswQxdvo6vkDc9Y7DqZKV 6 X-Received: by 2002:a05:6000:1544:b0:37d:393a:97c5 with SMTP id ffacd0b85a97d-38225a059a1mr9511199f8f.28.1731934068350; Mon, 18 Nov 2024 04:47:48 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38248b74ec6sm2579263f8f.38.2024.11.18.04.47.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-stable@nongnu.org, Michael Tokarev , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 11/15] Revert "hw/audio/hda: fix memory leak on audio setup" Date: Mon, 18 Nov 2024 13:46:38 +0100 Message-ID: <20241118124643.6958-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=unavailable 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: Paolo Bonzini This reverts commit 6d03242a7e47815ed56687ecd13f683d8da3f2fe, which causes SPICE audio to break. While arguably this is a SPICE bug, it is possible to fix the leak in a less heavy-handed way. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2639 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Michael Tokarev Message-ID: <20241114125318.1707590-2-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/audio/hda-codec.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index bc661504cf..74c0292284 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -472,24 +472,6 @@ static void hda_audio_set_amp(HDAAudioStream *st) } } -static void hda_close_stream(HDAAudioState *a, HDAAudioStream *st) -{ - if (st->node == NULL) { - return; - } - if (a->use_timer) { - timer_free(st->buft); - st->buft = NULL; - } - if (st->output) { - AUD_close_out(&a->card, st->voice.out); - st->voice.out = NULL; - } else { - AUD_close_in(&a->card, st->voice.in); - st->voice.in = NULL; - } -} - static void hda_audio_setup(HDAAudioStream *st) { bool use_timer = st->state->use_timer; @@ -502,7 +484,6 @@ static void hda_audio_setup(HDAAudioStream *st) trace_hda_audio_format(st->node->name, st->as.nchannels, fmt2name[st->as.fmt], st->as.freq); - hda_close_stream(st->state, st); if (st->output) { if (use_timer) { cb = hda_audio_output_cb; @@ -760,11 +741,23 @@ static void hda_audio_init(HDACodecDevice *hda, static void hda_audio_exit(HDACodecDevice *hda) { HDAAudioState *a = HDA_AUDIO(hda); + HDAAudioStream *st; int i; dprint(a, 1, "%s\n", __func__); for (i = 0; i < ARRAY_SIZE(a->st); i++) { - hda_close_stream(a, a->st + i); + st = a->st + i; + if (st->node == NULL) { + continue; + } + if (a->use_timer) { + timer_free(st->buft); + } + if (st->output) { + AUD_close_out(&a->card, st->voice.out); + } else { + AUD_close_in(&a->card, st->voice.in); + } } AUD_remove_card(&a->card); } From patchwork Mon Nov 18 12:46:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844088 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595412wrx; Mon, 18 Nov 2024 04:49:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVH5i6MDQzK+AGicOh94vW2LPxg2wyu4ZQqOsQBex4SKtMTb56AotRXn6y9dSrBr49jnESWLA==@linaro.org X-Google-Smtp-Source: AGHT+IE+Ye8OCLtOk4TN3pcIwXWKfWjZh2lu9Mgxulutq09o7mIr19oysUyJRIvucxtsb5MYy0ty X-Received: by 2002:a05:620a:28c6:b0:7b1:50ba:76e8 with SMTP id af79cd13be357-7b3622bf49bmr1408689285a.23.1731934144047; Mon, 18 Nov 2024 04:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934144; cv=none; d=google.com; s=arc-20240605; b=Nzfl/Ia5MNag35n7abmKdC589QkgRvo0X/MO9MYXqEJpULyoas4v2NWuEKVLYYhODu Rs+jn5Ze8hEWWw778NkcrcvePT9GOQIaLaAZEmkFBLAcvISpPFFGaWuw7DJ6//RoOVKu k2iktcMdV/VGBloQt5wMC4ICT8RC57HYLvJZqzvFsEKpwo7UJ8JVYBSrKYCDXgbntKrw bRw91lHHFYVLvpfXQut4UmKnSgCA/8QCzxdvHWlrISmIKdqMnJxe7mq3VZmuLdI4D+ng 1p8AIFdxfDcpmi3mxvo88+P/2vH4jb6qja/jojj78zD0EtIxL4+QJXR+H7M9ebYBNrUV PLkQ== 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=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; fh=qL0czp+eueBY7VUBTT/kKICzLrY+ihIcvjbbb0f0J3c=; b=VkzU6Dhkg+ukB8wRR6f5My75SlnwYTrpG0FgBekia2OcZqyLSXEoh31UAml1dmANSI 5Gq5y5xTVcZ/T4+Am7f5JioPDsv8yFwr7Wd7OPVLLMRxpvdk2gVTAlC/vFGaMy0WW++G X3BErCHlkV5E6v9OmGcJvCYpzaizKqZu00rXHBGKstklbdBrhj8lhj/opvJuZEArU27a XbG8Da6iORsXSUl1fExNtkQXHHhIIAwPS3c9W7XWmQk8xqfj8XZNnmAkvBS50sB+HUbU 11TCf8hNKMwsgxezkpvNQ0dA9G7hM+EW91c345IHn6bq9mZYaCIRp84429eURBvfuJ70 XMvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DIFQkBvb; 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-7b35ca87752si1053489985a.425.2024.11.18.04.49.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:49:04 -0800 (PST) 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=DIFQkBvb; 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 1tD1BX-00065g-ME; Mon, 18 Nov 2024 07:48:55 -0500 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 1tD1Ac-0004Ei-J6 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:03 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AZ-0005RM-Rg for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:57 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso18088605e9.0 for ; Mon, 18 Nov 2024 04:47:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934074; x=1732538874; 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=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; b=DIFQkBvb/zfEc8LqPrxIsMwrQ9ML3uAgym/lKlLqr9/X+2LUC+48CYera6qe3nUlxv CHlnzKnYEol93M3/qmh+83fBKD5pFSDLGWniYwxuGWZVpkZ69leQ2plIUbzlHn0F53kP HKoiFpZsqLVbZ1U0YUDvNYFJnZHQYnIFZhcWNWAxhoUifxvmttlCmOTTgdLdoGAatTvA eJSvwQ4newl2v/icdnr7KTy1cPxiSyasTUid8snan0Kct6sNA67Xs4FigK4SPDac6Z9D kc5X3hJkBUkyCzjfA7of/LIiG/xjw+Gj6ViotMFm1xdHRuBl5LSzt0Ao3LiC6NbaqzOl rRKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934074; x=1732538874; 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=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; b=Kj6O1PVqJs9bmNgYrqYx97ewK/Ov3CS96I0aijQgdPddFEzGL2gK6+sUU03B+br29A o6kggVA01M4DpgY/DaROFyIm4rhVDevWX1ixFCXmz3LUlEXs4aBesH4ChrubDGqsJH6b jNmk5kcqMqOeOHBSQFHdVwJJfAP/UFyjJ3Xk/d5lrKXBaN9E0Nmy0NUTSQJkkpAkIqhv 21IaixSIfOgob7WPZuL7y5CJ04cJiMoMItjsW1q1ifbpJaidd1xkxXIIrpB6H2xflE1F o6ZJ8NhLs8cpLh10pu9GcJzr/hXubd1wkL8KJWBDOQyDwxQaWSufr+eVa/tgsQxDJlFu hD2Q== X-Gm-Message-State: AOJu0YwiQiOoNp6v1V2dxY3wXN/32WaMMbTkCyEH6tSM6bf64rFJ9zOo 5ZDlt1ZQERwCvLPMpMv2Ep19bzmWgbWHSFBnBM7hH95BU0QjBg9eViso1gqB5mGO8PVDtr3sqXL J X-Received: by 2002:a05:600c:3143:b0:431:9397:9ace with SMTP id 5b1f17b1804b1-432df7411b0mr120048115e9.10.1731934074124; Mon, 18 Nov 2024 04:47:54 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da28cad9sm158081935e9.32.2024.11.18.04.47.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-stable@nongnu.org, Michael Tokarev , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/15] hw/audio/hda: fix memory leak on audio setup Date: Mon, 18 Nov 2024 13:46:39 +0100 Message-ID: <20241118124643.6958-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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=unavailable 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: Paolo Bonzini When SET_STREAM_FORMAT is called, the st->buft timer is overwritten, thus causing a memory leak. This was originally fixed in commit 816139ae6a5 ("hw/audio/hda: fix memory leak on audio setup", 2024-11-14) but that caused the audio to break in SPICE. Fortunately, a simpler fix is possible. The timer only needs to be reset, because the callback is always the same (st->output is set at realize time in hda_audio_init); call to timer_new_ns overkill. Replace it with timer_del and only initialize the timer once; for simplicity, do it even if use_timer is false. An even simpler fix would be to free the old time in hda_audio_setup(). However, it seems better to place the initialization of the timer close to that of st->ouput. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Michael Tokarev Message-ID: <20241114125318.1707590-3-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/audio/hda-codec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 74c0292284..c340a9481d 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -487,8 +487,7 @@ static void hda_audio_setup(HDAAudioStream *st) if (st->output) { if (use_timer) { cb = hda_audio_output_cb; - st->buft = timer_new_ns(QEMU_CLOCK_VIRTUAL, - hda_audio_output_timer, st); + timer_del(st->buft); } else { cb = hda_audio_compat_output_cb; } @@ -497,8 +496,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { if (use_timer) { cb = hda_audio_input_cb; - st->buft = timer_new_ns(QEMU_CLOCK_VIRTUAL, - hda_audio_input_timer, st); + timer_del(st->buft); } else { cb = hda_audio_compat_input_cb; } @@ -726,8 +724,12 @@ static void hda_audio_init(HDACodecDevice *hda, st->gain_right = QEMU_HDA_AMP_STEPS; st->compat_bpos = sizeof(st->compat_buf); st->output = true; + st->buft = timer_new_ns(QEMU_CLOCK_VIRTUAL, + hda_audio_output_timer, st); } else { st->output = false; + st->buft = timer_new_ns(QEMU_CLOCK_VIRTUAL, + hda_audio_input_timer, st); } st->format = AC_FMT_TYPE_PCM | AC_FMT_BITS_16 | (1 << AC_FMT_CHAN_SHIFT); @@ -750,9 +752,7 @@ static void hda_audio_exit(HDACodecDevice *hda) if (st->node == NULL) { continue; } - if (a->use_timer) { - timer_free(st->buft); - } + timer_free(st->buft); if (st->output) { AUD_close_out(&a->card, st->voice.out); } else { From patchwork Mon Nov 18 12:46:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844089 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595580wrx; Mon, 18 Nov 2024 04:49:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXCl1uc4ti0GVBg9RJ72oPnnkpmpOIt9SDha+Wqm/M6nDC8sQlj3E9Ag6wqmuEu7FXCz/hD9A==@linaro.org X-Google-Smtp-Source: AGHT+IGkD9VoTjXdoG8fc4Gc59mmdg5qgbFZa8hLGM74d2H+mApIMh6JRMVKCS4+GIjgCX7g7QQI X-Received: by 2002:a05:6902:1888:b0:e30:c977:a362 with SMTP id 3f1490d57ef6-e3825d3e3d6mr8339996276.7.1731934170954; Mon, 18 Nov 2024 04:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934170; cv=none; d=google.com; s=arc-20240605; b=bcZNTpZ03t5IbnmV/nCl6iRl3EvQ86SRejaTjGG+nmeyD0+IE63nLT2jnPn357UP4J vSFbXOY/wq57VC8zvmlFiWPbgZLoPCJCBbBHgxxlKjmE5MMCMqrI/D8dgV2c2Xm7TRnM 2R0kfd46CDi95oBQWv/fCy4BtSFzRVqUOjhiHqwca43nQPJ/mosQ+Qy620xzXzLWtkqx ZO1lV3ehJSnhQnzm1ae6NZh1t/D66K2KTZQ7BmfmRjP8SonJNPZr96MAdpo8Y7vk+sH+ mUO8lTVcCWh5ea1vXXp//3lay5MotxkLMtONJYozx2WswaliPVVLdVvxDRyv+jf4d8oP Jaqw== 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=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=Tmii14UMykP7QWVP3GIxZmy4aAw6NUCo+Jau4oYtlzs2jPiilG8TcJCGk6DDjBjbr1 ye4kK8WlSl+/VBqWPUy1JRkR3AtWTcHbbg3/t1qDhNB99LP4SrUUF4y4pFFL7ch1GFWN DcIEyPX11YUE4Kt/9CgBzOtoNOSlffZ8IIKw8jP2V+str/tjD0v6Ud2sK2Ha1VRl39Io hlV6xp/AG7m7Wnuyzkm18YgS+c7gTt8SxQjkia6yr0dui+DRP337uasytO0ty5l38nCa 5e6LDn4Qp1drOpdhey3P9O+1whoveAln7xe7mji2y3FHexR7RmEx0SmRe5OqJzbbEssy OOpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uCGhJvQJ; 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 6a1803df08f44-6d40dc42e26si63518106d6.183.2024.11.18.04.49.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:49:30 -0800 (PST) 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=uCGhJvQJ; 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 1tD1BO-0005Cd-Ee; Mon, 18 Nov 2024 07:48:46 -0500 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 1tD1B2-0004XT-S3 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:29 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Ah-0005Rf-70 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:19 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3823194a879so1563296f8f.0 for ; Mon, 18 Nov 2024 04:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934080; x=1732538880; 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=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; b=uCGhJvQJ8NsMdpwTKTXLIJAG+S9b3WJJfpPvg2ZTPvL6qOaOmRneJAcwnIoRax1X1d 6glAE1TgSHhPRskIq4lpF3O+ZswWdRi0i1MvvA4erpfsVdxJhA+2DIAnPiCV4Qwp/RyC TPziHyLhMG+lu5ZW0/951zYsYPFGxgMqL5D4NV5bAnZMZ96tC60qAXg/oCP0+Zl+VPPH qbvlL8oZ2AxkMlQ594q0sqY72iNht16ruxwbURT1obhTfZPc646MO6RGyqw38VT07yME cHOCvU2PHzUoVbB2rbcmrltjy8XMRG+xbuDogm6jfGJ959rNx8tyeFGpEUFM4A7uZWC2 MaRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934080; x=1732538880; 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=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; b=wXqRTAMpjIU/oHei0hbsZ8tUf8GCMVcr5GER0TqGZ5yzwOrcsBQBu8fw8kKfn4yhfv 4RQ9Tn3rFwNBEk+DyUPyJ9PnrCxPaos9I1LigjUEKDvIpPz0XOAfTl8u2RqBWbxM7rro tNGSbpbKmk8jaeY7xzrroh/FzckzuhVz1E85QQ209LwC/pVtGL1JAslCEma4mtNBAJOk A2qTWdMZmjTzRr48V8tvnjW7CTAYJjcWO4ZoTCfZyMXFgk8kqTFdjlcmadePTjV/2+lP DcZH6p5p723oR4fcn66A3TQIvrQ0Qv3F1Mt1HIGqLioJR0O41EIJAv6czIn6CEQnepWx QJDQ== X-Gm-Message-State: AOJu0YzVLbcKSww7cmuGGzbMzJ6FwfhTiVhI2/ycJd7jjgzAzmekD3K4 34CAOTxfWtH4X6/60i9k717m9c1LPz7I/NfW4Ipl57KsxkYyyfXaz/EBkTF8OIdS3ZHtU47YTkk c X-Received: by 2002:a05:6000:2a8:b0:382:372a:5718 with SMTP id ffacd0b85a97d-382372a5a17mr5566122f8f.26.1731934079649; Mon, 18 Nov 2024 04:47:59 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38244ff1ca3sm3810943f8f.26.2024.11.18.04.47.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 13/15] hw/net/virtio-net.c: Don't assume IP length field is aligned Date: Mon, 18 Nov 2024 13:46:40 +0100 Message-ID: <20241118124643.6958-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell In virtio-net.c we assume that the IP length field in the packet is aligned, and we copy its address into a uint16_t* in the VirtioNetRscUnit struct which we then dereference later. This isn't a safe assumption; it will also result in compilation failures if we mark the ip_header struct as QEMU_PACKED because the compiler will not let you take the address of an unaligned struct field. Make the ip_plen field in VirtioNetRscUnit a void*, and make all the places where we read or write through that pointer instead use some new accessor functions read_unit_ip_len() and write_unit_ip_len() which account for the pointer being potentially unaligned and also do the network-byte-order conversion we were previously using htons() to perform. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241114141619.806652-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/virtio/virtio-net.h | 2 +- hw/net/virtio-net.c | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 060c23c04d..b9ea9e824e 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -102,7 +102,7 @@ typedef struct VirtioNetRscStat { /* Rsc unit general info used to checking if can coalescing */ typedef struct VirtioNetRscUnit { void *ip; /* ip header */ - uint16_t *ip_plen; /* data len pointer in ip header field */ + void *ip_plen; /* pointer to unaligned uint16_t data len in ip header */ struct tcp_header *tcp; /* tcp header */ uint16_t tcp_hdrlen; /* tcp header len */ uint16_t payload; /* pure payload without virtio/eth/ip/tcp */ diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f2104ed364..75b4a28fb3 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2049,6 +2049,21 @@ static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf, return virtio_net_receive_rcu(nc, buf, size, false); } +/* + * Accessors to read and write the IP packet data length field. This + * is a potentially unaligned network-byte-order 16 bit unsigned integer + * pointed to by unit->ip_len. + */ +static uint16_t read_unit_ip_len(VirtioNetRscUnit *unit) +{ + return lduw_be_p(unit->ip_plen); +} + +static void write_unit_ip_len(VirtioNetRscUnit *unit, uint16_t l) +{ + stw_be_p(unit->ip_plen, l); +} + static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain, const uint8_t *buf, VirtioNetRscUnit *unit) @@ -2063,7 +2078,7 @@ static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain, unit->ip_plen = &ip->ip_len; unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip) + ip_hdrlen); unit->tcp_hdrlen = (htons(unit->tcp->th_offset_flags) & 0xF000) >> 10; - unit->payload = htons(*unit->ip_plen) - ip_hdrlen - unit->tcp_hdrlen; + unit->payload = read_unit_ip_len(unit) - ip_hdrlen - unit->tcp_hdrlen; } static void virtio_net_rsc_extract_unit6(VirtioNetRscChain *chain, @@ -2082,7 +2097,7 @@ static void virtio_net_rsc_extract_unit6(VirtioNetRscChain *chain, /* There is a difference between payload length in ipv4 and v6, ip header is excluded in ipv6 */ - unit->payload = htons(*unit->ip_plen) - unit->tcp_hdrlen; + unit->payload = read_unit_ip_len(unit) - unit->tcp_hdrlen; } static size_t virtio_net_rsc_drain_seg(VirtioNetRscChain *chain, @@ -2231,7 +2246,7 @@ static int32_t virtio_net_rsc_coalesce_data(VirtioNetRscChain *chain, VirtioNetRscUnit *o_unit; o_unit = &seg->unit; - o_ip_len = htons(*o_unit->ip_plen); + o_ip_len = read_unit_ip_len(o_unit); nseq = htonl(n_unit->tcp->th_seq); oseq = htonl(o_unit->tcp->th_seq); @@ -2267,7 +2282,7 @@ coalesce: o_unit->payload += n_unit->payload; /* update new data len */ /* update field in ip header */ - *o_unit->ip_plen = htons(o_ip_len + n_unit->payload); + write_unit_ip_len(o_unit, o_ip_len + n_unit->payload); /* Bring 'PUSH' big, the whql test guide says 'PUSH' can be coalesced for windows guest, while this may change the behavior for linux From patchwork Mon Nov 18 12:46:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844093 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp596056wrx; Mon, 18 Nov 2024 04:50:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU/YZnYuFe2zZUar3adGAo1yJRGErVEYmHR9f+gRnBfcrouR7SYEPAxrS2caZtr5ghuzI3r4A==@linaro.org X-Google-Smtp-Source: AGHT+IGiXoK9qrPGIHrAzfjoQ0HyzrgkYjfyr1Xi6tjT93QG07ec2lc+uulGaCdCHqCytCAny8+2 X-Received: by 2002:a05:622a:5c8d:b0:461:66e0:b676 with SMTP id d75a77b69052e-46363e171b1mr207299751cf.13.1731934238917; Mon, 18 Nov 2024 04:50:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934238; cv=none; d=google.com; s=arc-20240605; b=TYhL2Y265vyO5vVmLZ3CKiydxFId1y7HPf+hjAIzs/SWuy8nKRn/oC+bJPBUO0YKKJ vrVxUU9mTChnyl9Ta11tm/1OgL/klF7CUvgv40IYrtXUH+FfxfzJqpWKk4ZejwtnB9pK U+Q0NP+WoTSikB/+8l08tbrY+spsTkdZCw3+040xhga2Fnhcy3hLOpzHYpnLmCRkqCmi Ie88Bay9VgTNWk953CPMlctTfu+no7Qx90ylEpUM/f8p/Qstjkv0OhMIBMth72eyqCwb IEFehxqJ52TYICMw43j8d55CkMZ+Ske9szNi1KGbWVXNsI11K0oWejlQLIc43f6oaD0w xqCg== 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=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=Dh3jIcK1p7Gncp7tqOk1f0EsWM3mFr76HDj3jmTqfuf2wf+3tLh/Gk36Uf35MF7NQP dNts9Vpqi3SWYE0sjvrOlneflIaQa0MPQWhV+ZZgz+x3CQKkQtKjo8eTPKEWh6Fr7WuA OeOEuikZHQY8z78FvQxyuG9VUOlUApTVyEHQ3ODiWtVpCvCo2xigx0oScdO8Hgo7Cfu5 sZUkb7SDVmXiaDG9Xg6YkEYO6iD/0lrImx3StC4iSXYOQK5lCw4RyOy47GITg+FU/cEY 1F4c5hcGFXHgwlqi4J/sJzTJN8iTElzQkjRl5f8KBWunB0vUk2GSUjiXTDv2QYQ7FmLg mXFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ul6KecDM; 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 d75a77b69052e-4635aa9c4f5si112081541cf.318.2024.11.18.04.50.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:50:38 -0800 (PST) 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=ul6KecDM; 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 1tD1Ba-0006Wv-Rw; Mon, 18 Nov 2024 07:48:59 -0500 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 1tD1BB-0004c0-3I for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:37 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Az-0005Rs-56 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so34219485e9.1 for ; Mon, 18 Nov 2024 04:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934085; x=1732538885; 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=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; b=ul6KecDMMCUlCu1h5BcA/gCzcaGqJc+zYcJvQvXUEynJjDj+tmybmzxhbMLkZhxVpU CAVaK4iflU2QmrSvMdqoEdzggZUiYT0EP9CJiPiu1kTah+aR9+tDG2dAWhIrG9HbQq3M YnDhXpsaTIBADwqoz2JcgeMGYnEP50GKTP/3pY9aJt2R1QsrL81Paiww2Fq2AjInlcVN wISgGA4kLzE8klHgeJEF7u80WMsRq+6VLt9Q4yej79b9pyEWoTxSQHUN+/540pt/uTlk TTiUPK2emhQhPYDNFsYKtv+uSmN5BiqBxlofdyb/t9fIPv4jjDrZZqAu7prlZus7FU5j 0WkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934085; x=1732538885; 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=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; b=fQtcXqQ8tOyaV2uI02yq8xfJBjGkaB2skyMe7eK4gS9cWIDerMhfJIc8nJE8P8ssOP lJQ9LjhZzxmlQEiDHVfqp5WZbjYZwCvsuE/SUUodxnd8xBOmeULGMVOiPnIqJIs83GaU zZIs8gKpe804stHyPW+L0E3La0HxdRIGc8+VuPKT3bEhV7VuJwXEXn5KuLeiHCHbOkUs cA1Z+QxqXyzhvFti61spCiJTuxxCuV/C0htD9n1hrCskBHOYjL1kTaK+CZ7aEgSgxkAh 5VTwW7Xv79Wpu3m37Fp3v7PsC8dijpMIXmO303q7x4aWeCtk7KTKED2OUhlmwCjV7OII RWcg== X-Gm-Message-State: AOJu0YzhxXKzf34DSUyqTfT+9Ex6HYg/JIKdM384DOAxt8ZKw/MIc1jN iUD8YfrBzVHyWqzOsZJX/eJHBMvPbQEaT5mwlXZ1cvM9md8xJHt9S1MW/u1TuJzoM54bi7oH+97 i X-Received: by 2002:a05:600c:1d90:b0:42c:a905:9384 with SMTP id 5b1f17b1804b1-432df791f39mr93347075e9.20.1731934085128; Mon, 18 Nov 2024 04:48:05 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab72141sm154245905e9.1.2024.11.18.04.48.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:48:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 14/15] net: mark struct ip_header as QEMU_PACKED Date: Mon, 18 Nov 2024 13:46:41 +0100 Message-ID: <20241118124643.6958-15-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell The ip_header is not actually guaranteed to be aligned. We attempt to deal with this in some places such as net_checksum_calculate() by using stw_be_p and so on to access the fields, but this is not sufficient to be correct, because even accessing a byte member within an unaligned struct is undefined behaviour. The clang sanitizer will emit warnings like these if net_checksum_calculate() is called: Stopping network: ../../net/checksum.c:106:9: runtime error: member access within misaligned address 0x556aad9b502e for type 'struct ip_header', which requires 4 byte alignment 0x556aad9b502e: note: pointer points here 34 56 08 00 45 00 01 48 a5 09 40 00 40 11 7c 8b 0a 00 02 0f 0a 00 02 02 00 44 00 43 01 34 19 56 ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../net/checksum.c:106:9 in ../../net/checksum.c:106:9: runtime error: load of misaligned address 0x556aad9b502e for type 'uint8_t' (aka 'unsigned char'), which requires 4 byte alignment 0x556aad9b502e: note: pointer points here 34 56 08 00 45 00 01 48 a5 09 40 00 40 11 7c 8b 0a 00 02 0f 0a 00 02 02 00 44 00 43 01 34 19 56 ^ Fix this by marking the ip_header struct as QEMU_PACKED, so that the compiler knows that it might be unaligned and will generate the right code for accessing fields. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241114141619.806652-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/net/eth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/eth.h b/include/net/eth.h index 3b80b6e07f..14c34f530f 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -56,7 +56,7 @@ struct ip_header { uint8_t ip_p; /* protocol */ uint16_t ip_sum; /* checksum */ uint32_t ip_src, ip_dst; /* source and destination address */ -}; +} QEMU_PACKED; typedef struct tcp_header { uint16_t th_sport; /* source port */ From patchwork Mon Nov 18 12:46:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 844090 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp595579wrx; Mon, 18 Nov 2024 04:49:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUa67dOu6Nt+vjIefbkwk1Icbaihd6UUotORHsA2DgKsbeOTPZ+WX6+VhxfAh9QFJRIzp2JDg==@linaro.org X-Google-Smtp-Source: AGHT+IFvJNRhglb301khxqjXv/pqvF4R0yJFWSNGfDtJn/okF9RRI5MsiusoUjKEi/ITPVNeH/3g X-Received: by 2002:a05:6214:2f85:b0:6d3:fa73:c1dd with SMTP id 6a1803df08f44-6d3fb8857edmr185315086d6.35.1731934170914; Mon, 18 Nov 2024 04:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731934170; cv=none; d=google.com; s=arc-20240605; b=N9Ip5I7kyjpEvYm43MQwWMhGoHs4oSB4P0vBDP7+vNJETIY+xi3lPUXM+ioYvGxKnF DnOocte5hfrqyJ18HBvwUZx0Vo8DcccAK6OYshlhyVYX8f5ORtpeTvD77QqtOAf0qXa6 YRyjPJ/VCHOjZsMnX5SmAGIVM9nBLQZJcphxdtbHCbmeeN6WdF2OpsPDHx2U9/DlqhoE Tz18TPWWdnpaM3loQukdcZriyJ4G0oWZ75RwCzUuuZ9s3QoDTNjkHPjzEK2CPxC89w9s an8dJWqWFNCTCfauY1fLncSHsTzDABC0F2+vvy0DOq6KZ9F3ZDRtqetroqPrPc3tMxv1 AqqA== 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=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; fh=kyISoyA2A4FzPFYmCgPQg9VpCmm4kmeYLNjZJ5RDS2M=; b=UW2oHoZDG7OKHaz9lairEYRoBgc8BLWdLJ2bO9aGCtF5fUIc4rHeCwxH/oVw+3LDa0 w4/uI6ArsVWYZ/aEpqdvR3ROdjX/oQnl2UZEsIyUvB0q6YG3J7m2dYQZNDWxYN9dXDFg LdfHA7730MH5Th4ZvKHePS6FnWCF4lLVlMfu6EE/VdvOztrGBmEvcy/gVm+1j0d2W06I uJAAy9t3+H4XJqhTCl8tv4nbij61o6tYDpXtW2G8PCzJnP3Zv8UEgo7BSwewjuOqeFAq oKkk4FoH/PGgdDUeUR3KMPtdM1HptFTTv3ii+nuR8rlgq0oexwM9AQKGfa7ARyRj4W2f xyxg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CMgsvkmc; 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 6a1803df08f44-6d40dcd653dsi63034416d6.441.2024.11.18.04.49.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 04:49:30 -0800 (PST) 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=CMgsvkmc; 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 1tD1BU-0005dA-38; Mon, 18 Nov 2024 07:48:52 -0500 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 1tD1B2-0004XV-Se for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:30 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Aw-0005SC-Gw for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:21 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43169902057so34282065e9.0 for ; Mon, 18 Nov 2024 04:48:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934091; x=1732538891; 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=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; b=CMgsvkmcUHQOQpyONJGDbpx7VB6ieLu1c1mlxekPa6hhqDtUXHczDW3QxRyIF5Qi9f jbQ4CA0G6BbYMLLI4J65+o8w5zjx6LWfRgS0fxdOqVoVYZ4zBTCJtpus5vCdmcrf4kel Y2vbDtDPFDRMK6QpPSl67WtEtuT8YFootBSePWreDTaUqCOO7/G+tVrnXfZozh8VsXZE tGo+kyQasU+OOeLKQPqty/F3J1KceF5NJizGrEy28IauWBsyH+NdQUh52P3/Ve+lD12N DQ4XOGgIWTzf13v0mWBU5mO5ih4xxA4YiB40H/rpj7+J4ShGU62VmemyGn1zEn9WwCRo 4hRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934091; x=1732538891; 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=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; b=f+QkbXda942P6/mD+3J97BmTt/8sh2rY3uYfXdeHJCrWOK4kA+tpFeZJ66tE5NWA24 QaPBYEKElsf0K2VbAO1cZO/+hBP8ryBPKtXSxpfhFAGc8p+AmEgWGy3btQSGG1wk2iyp 3DPQ0ZvL4sg05571GSicB/tmrTWaRV9CJqvP0Lk9zm6poHmYs+IoacqQN9u4lR9cYmRu I0r6IVtFFXsZjIQGjSa55oP2FSZPFeqL0WQxgpIoS4jufues2r22SBdMf1G6CnW/VXEZ 1U9ERBvR/ioyaDmZ7na/RJF3JDWapmhc0B9jPwzdWjGnzwns6dR6E99BSEmKD6gtFMVN 59JA== X-Gm-Message-State: AOJu0Yw0w/KU+68ZznIUyBLCUU2tsMH1HjChh0AZensCIX5yVpfeRCI1 Ke1YRqVlsaPrWbMsi5ct4DbMYmGPdPL1ASBo5+EQLSPaV9QfA0jff9nBum5aoqfm1AV3LjaRlLk y X-Received: by 2002:a05:6000:2c6:b0:382:1c58:5787 with SMTP id ffacd0b85a97d-38225a89fe4mr11523224f8f.46.1731934090708; Mon, 18 Nov 2024 04:48:10 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-382371a5646sm7362071f8f.0.2024.11.18.04.48.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:48:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Roque Arcudia Hernandez , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PULL 15/15] hw/watchdog/cmsdk_apb_watchdog: Fix broken link Date: Mon, 18 Nov 2024 13:46:42 +0100 Message-ID: <20241118124643.6958-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Roque Arcudia Hernandez The patch changes the comments to point to the latest Design Kit Technical Reference Manual. Signed-off-by: Roque Arcudia Hernandez Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20241115160328.1650269-2-roqueh@google.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/watchdog/cmsdk-apb-watchdog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c index 7ad46f9410..e4d25a25f7 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -12,8 +12,8 @@ /* * This is a model of the "APB watchdog" which is part of the Cortex-M * System Design Kit (CMSDK) and documented in the Cortex-M System - * Design Kit Technical Reference Manual (ARM DDI0479C): - * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit + * Design Kit Technical Reference Manual (ARM DDI0479): + * https://developer.arm.com/documentation/ddi0479/ * * We also support the variant of this device found in the TI * Stellaris/Luminary boards and documented in: