From patchwork Thu Jul 14 09:01:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cxVfnkis; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7pk1SlVz9sB4 for ; Thu, 14 Jul 2022 19:04:28 +1000 (AEST) Received: from localhost ([::1]:47078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBull-000518-AL for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:04:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujn-0004yS-3j for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujj-0005tC-CV for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/StMYsUR3T7ZIFnX+3IHWI68Ox7ds1R1I5k3Oio9zwQ=; b=cxVfnkisZZGdP+x+k0+NWrLObKjNL1Ec+EGAYSnlgGJYCZBMAE3lI6NCqeTFl0Cz3ELG8W ITLzb0v51swMratuFZBgDHKrTYbCSG20wBD8oh4M5I7QNgmqPIYCu8mEuaQYPNjQULrZgt EbVkRsZbIjivri2+1hGEp0RxkTtsLPI= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-6C24Zz1INLqFRZx7LYWQYQ-1; Thu, 14 Jul 2022 05:02:17 -0400 X-MC-Unique: 6C24Zz1INLqFRZx7LYWQYQ-1 Received: by mail-ed1-f71.google.com with SMTP id z5-20020a05640235c500b0043ae18edeeeso1109052edc.5 for ; Thu, 14 Jul 2022 02:02:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/StMYsUR3T7ZIFnX+3IHWI68Ox7ds1R1I5k3Oio9zwQ=; b=uMhdn8C1EQnq5Z1TAGOEKqwf5qk7YlvOE9+JgjLLYunS116ddNDiWA5kZ0YND02xkn mvU4EHlJ8+0tiH3AIOhq0KUb38a6SoMEAIwaKSC7RL7+f9/MnmUwBj2q+WUTB5qEKBjr UaHUWjyYl2lfOmRjKuDxH+wO7cSBW5m1i0qBjLBNnUzN7l+u7zyfvrXpy9tE6zgG+L/W ZSXjghsZkZCVSRgRIBYrQQPYr3WrIXbnEpDbtDCex70v9iqgTHLIfTtZMB5I6QqcrRpR W4JgpAryFoQ58Cb1G0TIiDAZqDBeqYS5qXaw6fnvwjYeRlxxf24DZJu5QPz40/ag7VDj ZXhQ== X-Gm-Message-State: AJIora8Ufuaf5anpcSyTYUS+Z7uwpE3Yya1JKnEGD1WiH8IF3XTXhHLo RGdnN/rryrdT99ljXHrPFq5nGHcmDTc8MID9bzKZw/LdI5eI8WT9LSOs03G+12teFANpVuF3rtb iKy0a5AUY7Kn2KMFJPRZ/iRrKKKAwv0NSSG9Ae9oLxXDqYNDPLWdSJddy1/rHzCE74hc= X-Received: by 2002:a17:907:2855:b0:72b:700e:21eb with SMTP id el21-20020a170907285500b0072b700e21ebmr7730060ejc.270.1657789335971; Thu, 14 Jul 2022 02:02:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ukoh8+chckfjRMfXdK0zR1Mxxt7xqvPraXUcDR+hbEP858NgtYwm+NzKKaTddGPmiBngZPcQ== X-Received: by 2002:a17:907:2855:b0:72b:700e:21eb with SMTP id el21-20020a170907285500b0072b700e21ebmr7730033ejc.270.1657789335672; Thu, 14 Jul 2022 02:02:15 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id m20-20020a170906721400b0071cbc7487e0sm452770ejk.71.2022.07.14.02.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mauro Matteo Cascella , Alexander Bulekov Subject: [PULL 01/20] scsi/lsi53c895a: really fix use-after-free in lsi_do_msgout (CVE-2022-0216) Date: Thu, 14 Jul 2022 11:01:52 +0200 Message-Id: <20220714090211.304305-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mauro Matteo Cascella Set current_req to NULL, not current_req->req, to prevent reusing a free'd buffer in case of repeated SCSI cancel requests. Also apply the fix to CLEAR QUEUE and BUS DEVICE RESET messages as well, since they also cancel the request. Thanks to Alexander Bulekov for providing a reproducer. Fixes: CVE-2022-0216 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972 Signed-off-by: Mauro Matteo Cascella Tested-by: Alexander Bulekov Message-Id: <20220711123316.421279-1-mcascell@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/lsi53c895a.c | 3 +- tests/qtest/fuzz-lsi53c895a-test.c | 76 ++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 99ea42d49b..ad5f5e5f39 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -1030,7 +1030,7 @@ static void lsi_do_msgout(LSIState *s) trace_lsi_do_msgout_abort(current_tag); if (current_req && current_req->req) { scsi_req_cancel(current_req->req); - current_req->req = NULL; + current_req = NULL; } lsi_disconnect(s); break; @@ -1056,6 +1056,7 @@ static void lsi_do_msgout(LSIState *s) /* clear the current I/O process */ if (s->current) { scsi_req_cancel(s->current->req); + current_req = NULL; } /* As the current implemented devices scsi_disk and scsi_generic diff --git a/tests/qtest/fuzz-lsi53c895a-test.c b/tests/qtest/fuzz-lsi53c895a-test.c index 2e8e67859e..b23d3ecf45 100644 --- a/tests/qtest/fuzz-lsi53c895a-test.c +++ b/tests/qtest/fuzz-lsi53c895a-test.c @@ -8,6 +8,79 @@ #include "qemu/osdep.h" #include "libqtest.h" +/* + * This used to trigger a UAF in lsi_do_msgout() + * https://gitlab.com/qemu-project/qemu/-/issues/972 + */ +static void test_lsi_do_msgout_cancel_req(void) +{ + QTestState *s; + + if (sizeof(void *) == 4) { + g_test_skip("memory size too big for 32-bit build"); + return; + } + + s = qtest_init("-M q35 -m 4G -display none -nodefaults " + "-device lsi53c895a,id=scsi " + "-device scsi-hd,drive=disk0 " + "-drive file=null-co://,id=disk0,if=none,format=raw"); + + qtest_outl(s, 0xcf8, 0x80000810); + qtest_outl(s, 0xcf8, 0xc000); + qtest_outl(s, 0xcf8, 0x80000810); + qtest_outw(s, 0xcfc, 0x7); + qtest_outl(s, 0xcf8, 0x80000810); + qtest_outl(s, 0xcfc, 0xc000); + qtest_outl(s, 0xcf8, 0x80000804); + qtest_outw(s, 0xcfc, 0x05); + qtest_writeb(s, 0x69736c10, 0x08); + qtest_writeb(s, 0x69736c13, 0x58); + qtest_writeb(s, 0x69736c1a, 0x01); + qtest_writeb(s, 0x69736c1b, 0x06); + qtest_writeb(s, 0x69736c22, 0x01); + qtest_writeb(s, 0x69736c23, 0x07); + qtest_writeb(s, 0x69736c2b, 0x02); + qtest_writeb(s, 0x69736c48, 0x08); + qtest_writeb(s, 0x69736c4b, 0x58); + qtest_writeb(s, 0x69736c52, 0x04); + qtest_writeb(s, 0x69736c53, 0x06); + qtest_writeb(s, 0x69736c5b, 0x02); + qtest_outl(s, 0xc02d, 0x697300); + qtest_writeb(s, 0x5a554662, 0x01); + qtest_writeb(s, 0x5a554663, 0x07); + qtest_writeb(s, 0x5a55466a, 0x10); + qtest_writeb(s, 0x5a55466b, 0x22); + qtest_writeb(s, 0x5a55466c, 0x5a); + qtest_writeb(s, 0x5a55466d, 0x5a); + qtest_writeb(s, 0x5a55466e, 0x34); + qtest_writeb(s, 0x5a55466f, 0x5a); + qtest_writeb(s, 0x5a345a5a, 0x77); + qtest_writeb(s, 0x5a345a5b, 0x55); + qtest_writeb(s, 0x5a345a5c, 0x51); + qtest_writeb(s, 0x5a345a5d, 0x27); + qtest_writeb(s, 0x27515577, 0x41); + qtest_outl(s, 0xc02d, 0x5a5500); + qtest_writeb(s, 0x364001d0, 0x08); + qtest_writeb(s, 0x364001d3, 0x58); + qtest_writeb(s, 0x364001da, 0x01); + qtest_writeb(s, 0x364001db, 0x26); + qtest_writeb(s, 0x364001dc, 0x0d); + qtest_writeb(s, 0x364001dd, 0xae); + qtest_writeb(s, 0x364001de, 0x41); + qtest_writeb(s, 0x364001df, 0x5a); + qtest_writeb(s, 0x5a41ae0d, 0xf8); + qtest_writeb(s, 0x5a41ae0e, 0x36); + qtest_writeb(s, 0x5a41ae0f, 0xd7); + qtest_writeb(s, 0x5a41ae10, 0x36); + qtest_writeb(s, 0x36d736f8, 0x0c); + qtest_writeb(s, 0x36d736f9, 0x80); + qtest_writeb(s, 0x36d736fa, 0x0d); + qtest_outl(s, 0xc02d, 0x364000); + + qtest_quit(s); +} + /* * This used to trigger the assert in lsi_do_dma() * https://bugs.launchpad.net/qemu/+bug/697510 @@ -44,5 +117,8 @@ int main(int argc, char **argv) qtest_add_func("fuzz/lsi53c895a/lsi_do_dma_empty_queue", test_lsi_do_dma_empty_queue); + qtest_add_func("fuzz/lsi53c895a/lsi_do_msgout_cancel_req", + test_lsi_do_msgout_cancel_req); + return g_test_run(); } From patchwork Thu Jul 14 09:01:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656287 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dr98QUML; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7vB1Pkmz9sB4 for ; Thu, 14 Jul 2022 19:08:22 +1000 (AEST) Received: from localhost ([::1]:51930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBupY-0008TY-1m for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:08:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujn-00050s-Vt for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujl-0005uO-LA for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fX03v0kOkH7rjZboIn4udYC6Bm8zLRFu9JPvkv7s92s=; b=dr98QUMLzqy5x/ecMJbL8/DuI7APbcNE5FnYIwtOTV2CZ1lNsD921AjE+rFwln+VoHQ9BZ Naud8clZ+yjBqpXyMW6PRLxKhyhHZHsBTG3kQKzUL4H0T8q81pbb4bzC5OHRjRpcbVSiv0 iiZqPBikPgL8lJrLao4jdfzgg9zP0f8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-77--iWUFzGwOOKGq5lizLeVCA-1; Thu, 14 Jul 2022 05:02:19 -0400 X-MC-Unique: -iWUFzGwOOKGq5lizLeVCA-1 Received: by mail-ed1-f69.google.com with SMTP id m13-20020a056402430d00b0043ac2f27d83so1098907edc.20 for ; Thu, 14 Jul 2022 02:02:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fX03v0kOkH7rjZboIn4udYC6Bm8zLRFu9JPvkv7s92s=; b=oJ4eH9ZBNp9dog1SCnul2RF5RTOne0oIiMTWtEHcibrGYPmXhqY4DA7aalWSLP4GYI /9GgCmLtSpuJLnQWWHVb9kXgN9JaTgwmz9yYuPkIgBMPO22K/l28XTOFRzeVfmZE4Pph LS6sjOpnJcKa7pdq67o1p7xrZMER54dOzS6w8LH8UhYt62tk0ZEAoqWyDA5wjlj+QaWK OmNiFuU2t48nix94so2hggkabUvzD4LBGACC6RjsIO21//kvCpzeV/qfYDIkfm51RNOa 8Bu/9rX6Ln3IU+azItEbTTQ46pUY6dkFnfEnASOpL3/3ntHZfqTjWebbWuRjaPLIOeBZ 8Wxw== X-Gm-Message-State: AJIora9v081t0+opqcBKVx6TFfdte3PzqzSJWR+fwN8IPNSl+qggQRWJ afb1piuYHBFnhtjB3eQR2ng7DF4u0ePEcQzIstpyndzOX/8nuXIDOAP3NxXuxblc+mpJ54o/lYc q40NIZh6UCd6re9VJO99G1eF/0/cQI4vM0T7/6quOqJ9qTKIK92KtHJg6l8tN71OIDwA= X-Received: by 2002:a05:6402:42c8:b0:43a:a1ee:a097 with SMTP id i8-20020a05640242c800b0043aa1eea097mr10826056edc.150.1657789337772; Thu, 14 Jul 2022 02:02:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t8mcBP6RVEwVkjfl0g6SDFObhG/kl39YNBjb5ls03fDdfQrUyNAmpr6ZwH4rV+EX/x90MLyA== X-Received: by 2002:a05:6402:42c8:b0:43a:a1ee:a097 with SMTP id i8-20020a05640242c800b0043aa1eea097mr10826026edc.150.1657789337396; Thu, 14 Jul 2022 02:02:17 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id b6-20020a170906038600b00711edab7622sm455347eja.40.2022.07.14.02.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 02/20] cutils: Introduce bundle mechanism Date: Thu, 14 Jul 2022 11:01:53 +0200 Message-Id: <20220714090211.304305-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki Developers often run QEMU without installing. The bundle mechanism allows to look up files which should be present in installation even in such a situation. It is a general mechanism and can find any files in the installation tree. The build tree will have a new directory, qemu-bundle, to represent what files the installation tree would have for reference by the executables. Note that it abandons compatibility with Windows older than 8. The extended support for the prior version, 7 ended more than 2 years ago, and it is unlikely that someone would like to run the latest QEMU on such an old system. Signed-off-by: Akihiko Odaki Suggested-by: Paolo Bonzini Message-Id: <20220624145039.49929-3-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- Makefile | 2 +- docs/about/build-platforms.rst | 2 +- include/qemu/cutils.h | 18 +++++++-- meson.build | 4 ++ scripts/symlink-install-tree.py | 33 +++++++++++++++++ util/cutils.c | 66 +++++++++++++++++++++++---------- util/meson.build | 1 + 7 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 scripts/symlink-install-tree.py diff --git a/Makefile b/Makefile index b4feda93c8..13234f2aa4 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ qemu-%.tar.bz2: distclean: clean -$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || : - rm -f config-host.mak + rm -f config-host.mak qemu-bundle rm -f tests/tcg/config-*.mak rm -f config.status rm -f roms/seabios/config.mak diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst index 1958edb430..ebde20f981 100644 --- a/docs/about/build-platforms.rst +++ b/docs/about/build-platforms.rst @@ -88,7 +88,7 @@ Windows The project aims to support the two most recent versions of Windows that are still supported by the vendor. The minimum Windows API that is currently -targeted is "Windows 7", so theoretically the QEMU binaries can still be run +targeted is "Windows 8", so theoretically the QEMU binaries can still be run on older versions of Windows, too. However, such old versions of Windows are not tested anymore, so it is recommended to use one of the latest versions of Windows instead. diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index d3e532b64c..92c436d8c7 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -224,9 +224,21 @@ const char *qemu_get_exec_dir(void); * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated. * * Returns a path for @dir that uses the directory of the running executable - * as the prefix. For example, if `bindir` is `/usr/bin` and @dir is - * `/usr/share/qemu`, the function will append `../share/qemu` to the - * directory that contains the running executable and return the result. + * as the prefix. + * + * When a directory named `qemu-bundle` exists in the directory of the running + * executable, the path to the directory will be prepended to @dir. For + * example, if the directory of the running executable is `/qemu/build` @dir + * is `/usr/share/qemu`, the result will be + * `/qemu/build/qemu-bundle/usr/share/qemu`. The directory is expected to exist + * in the build tree. + * + * Otherwise, the directory of the running executable will be used as the + * prefix and it appends the relative path from `bindir` to @dir. For example, + * if the directory of the running executable is `/opt/qemu/bin`, `bindir` is + * `/usr/bin` and @dir is `/usr/share/qemu`, the result will be + * `/opt/qemu/bin/../share/qemu`. + * * The returned string should be freed by the caller. */ char *get_relocated_path(const char *dir); diff --git a/meson.build b/meson.build index ad92d288a6..da76edc7c7 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,8 @@ add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true) add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow']) add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough']) +meson.add_postconf_script(find_program('scripts/symlink-install-tree.py')) + not_found = dependency('', required: false) keyval = import('keyval') ss = import('sourceset') @@ -356,10 +358,12 @@ nvmm =not_found hvf = not_found midl = not_found widl = not_found +pathcch = not_found host_dsosuf = '.so' if targetos == 'windows' midl = find_program('midl', required: false) widl = find_program('widl', required: false) + pathcch = cc.find_library('pathcch') socket = cc.find_library('ws2_32') winmm = cc.find_library('winmm') diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py new file mode 100644 index 0000000000..a5bf0b0d6d --- /dev/null +++ b/scripts/symlink-install-tree.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +from pathlib import PurePath +import errno +import json +import os +import subprocess +import sys + +def destdir_join(d1: str, d2: str) -> str: + if not d1: + return d2 + # c:\destdir + c:\prefix must produce c:\destdir\prefix + return str(PurePath(d1, *PurePath(d2).parts[1:])) + +introspect = os.environ.get('MESONINTROSPECT') +out = subprocess.run([*introspect.split(' '), '--installed'], + stdout=subprocess.PIPE, check=True).stdout +for source, dest in json.loads(out).items(): + assert os.path.isabs(source) + bundle_dest = destdir_join('qemu-bundle', dest) + path = os.path.dirname(bundle_dest) + try: + os.makedirs(path, exist_ok=True) + except BaseException as e: + print(f'error making directory {path}', file=sys.stderr) + raise e + try: + os.symlink(source, bundle_dest) + except BaseException as e: + if not isinstance(e, OSError) or e.errno != errno.EEXIST: + print(f'error making symbolic link {dest}', file=sys.stderr) + raise e diff --git a/util/cutils.c b/util/cutils.c index 6d04e52907..8199dac598 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -35,6 +35,11 @@ #include #endif +#ifdef G_OS_WIN32 +#include +#include +#endif + #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/error-report.h" @@ -1074,31 +1079,52 @@ char *get_relocated_path(const char *dir) /* Fail if qemu_init_exec_dir was not called. */ assert(exec_dir[0]); - if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { - return g_strdup(dir); - } result = g_string_new(exec_dir); + g_string_append(result, "/qemu-bundle"); + if (access(result->str, R_OK) == 0) { +#ifdef G_OS_WIN32 + size_t size = mbsrtowcs(NULL, &dir, 0, &(mbstate_t){0}) + 1; + PWSTR wdir = g_new(WCHAR, size); + mbsrtowcs(wdir, &dir, size, &(mbstate_t){0}); - /* Advance over common components. */ - len_dir = len_bindir = prefix_len; - do { - dir += len_dir; - bindir += len_bindir; - dir = next_component(dir, &len_dir); - bindir = next_component(bindir, &len_bindir); - } while (len_dir && len_dir == len_bindir && !memcmp(dir, bindir, len_dir)); + PCWSTR wdir_skipped_root; + PathCchSkipRoot(wdir, &wdir_skipped_root); - /* Ascend from bindir to the common prefix with dir. */ - while (len_bindir) { - bindir += len_bindir; - g_string_append(result, "/.."); - bindir = next_component(bindir, &len_bindir); + size = wcsrtombs(NULL, &wdir_skipped_root, 0, &(mbstate_t){0}); + char *cursor = result->str + result->len; + g_string_set_size(result, result->len + size); + wcsrtombs(cursor, &wdir_skipped_root, size + 1, &(mbstate_t){0}); + g_free(wdir); +#else + g_string_append(result, dir); +#endif + } else if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { + g_string_assign(result, dir); + } else { + g_string_assign(result, exec_dir); + + /* Advance over common components. */ + len_dir = len_bindir = prefix_len; + do { + dir += len_dir; + bindir += len_bindir; + dir = next_component(dir, &len_dir); + bindir = next_component(bindir, &len_bindir); + } while (len_dir && len_dir == len_bindir && !memcmp(dir, bindir, len_dir)); + + /* Ascend from bindir to the common prefix with dir. */ + while (len_bindir) { + bindir += len_bindir; + g_string_append(result, "/.."); + bindir = next_component(bindir, &len_bindir); + } + + if (*dir) { + assert(G_IS_DIR_SEPARATOR(dir[-1])); + g_string_append(result, dir - 1); + } } - if (*dir) { - assert(G_IS_DIR_SEPARATOR(dir[-1])); - g_string_append(result, dir - 1); - } return g_string_free(result, false); } diff --git a/util/meson.build b/util/meson.build index 8cce8f8968..5e282130df 100644 --- a/util/meson.build +++ b/util/meson.build @@ -23,6 +23,7 @@ util_ss.add(when: 'CONFIG_WIN32', if_true: files('event_notifier-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: files('qemu-thread-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: winmm) +util_ss.add(when: 'CONFIG_WIN32', if_true: pathcch) util_ss.add(files('envlist.c', 'path.c', 'module.c')) util_ss.add(files('host-utils.c')) util_ss.add(files('bitmap.c', 'bitops.c')) From patchwork Thu Jul 14 09:01:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iHYtwsfb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7sj6n1pz9sB4 for ; Thu, 14 Jul 2022 19:07:05 +1000 (AEST) Received: from localhost ([::1]:49998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBuoJ-00076N-7l for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:07:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujt-00056F-Dd for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujn-0005ub-RG for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PuZojlBvMJHakpry/pxYzjDQngsN2NNKxuawl1RMhPU=; b=iHYtwsfbdZJc7i2ec8P78jXYDcqKSrQUqmCfyjjhvty89NcrZUOdqxLRpsKRGpp4o1NAXb Ug5ivHRnbiO8CGkJBrsPMXVxwfCVXDw4RpjFInI5dwpM2O6bQ7wl86GvR1DOnGWE1uPcKH uF58QVFxra1neEIO4CXIHUr9TRglodE= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-MqQ9yY68N96reyfVW6TU0g-1; Thu, 14 Jul 2022 05:02:21 -0400 X-MC-Unique: MqQ9yY68N96reyfVW6TU0g-1 Received: by mail-ej1-f70.google.com with SMTP id s4-20020a170906500400b006feaccb3a0eso507962ejj.11 for ; Thu, 14 Jul 2022 02:02:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PuZojlBvMJHakpry/pxYzjDQngsN2NNKxuawl1RMhPU=; b=3YBy/JZ0bsfg7+u2LbN0PBQtsyrwqHeZ4Jz1ZvRmhNkl+6iLbor24HRr51+So4ihsu 2ger11Oe3FJoHMq2RLGQLqQtGuROF/50e1wApDRryRmPH1x7oKui4JvHNWMb44DDkYx7 vIgvoDTbSUnkJyTQtR7IquekjF7G93Wwk40DHQNbmCgbN8btoSEGEdn/9JSSASLiCLW6 RGahnYHqE2kc3b4gymuMKG+Irw55d4jGTtFTgW6zeaXeuYo3Al2HaIIboRwH2fe6AvME ptY6K3n2RGyP/j/48Ckj3cZhK65vCgZYMMnlQvRRAKd2WOhh909LjhmfCrW7ecWaBmYS WkCw== X-Gm-Message-State: AJIora/sR4CcNdF7jYSpd/vIoKOUIfq6SODcxshTUhwXafSvUpuaSDQ4 jVMA63CXVrISekVbExJqRggTR/dTuONFFOk/LN00VkVmBrtt7yZJpXYSzvOauH8wn92m5Houd0r e9+Yz8WMX8Ebmg3vYBv/yvJ4DBVPJajfx5anBRPvgIZ+fhzq8RiDG2RtsqzqaoxN/o5s= X-Received: by 2002:a17:906:4786:b0:722:e5ac:7d96 with SMTP id cw6-20020a170906478600b00722e5ac7d96mr8071565ejc.172.1657789339587; Thu, 14 Jul 2022 02:02:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szn6ZZSS89yyjVTCMqwCayjt6Bl/sdpOAXFSd9CezXduDrr0t9lwp//DH9/CE4P2bVlVjq5A== X-Received: by 2002:a17:906:4786:b0:722:e5ac:7d96 with SMTP id cw6-20020a170906478600b00722e5ac7d96mr8071538ejc.172.1657789339218; Thu, 14 Jul 2022 02:02:19 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id l9-20020a1709063d2900b00722f66fb36csm447677ejf.112.2022.07.14.02.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 03/20] datadir: Use bundle mechanism Date: Thu, 14 Jul 2022 11:01:54 +0200 Message-Id: <20220714090211.304305-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki softmmu/datadir.c had its own implementation to find files in the build tree, but now bundle mechanism provides the unified implementation which works for datadir and the other files. Signed-off-by: Akihiko Odaki Message-Id: <20220624145039.49929-4-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- .travis.yml | 2 +- pc-bios/keymaps/meson.build | 21 ++++++--------------- pc-bios/meson.build | 13 +++---------- scripts/oss-fuzz/build.sh | 8 ++++---- softmmu/datadir.c | 22 +--------------------- tests/qtest/fuzz/fuzz.c | 18 ------------------ 6 files changed, 15 insertions(+), 69 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9afc4a54b8..4fdc9a6785 100644 --- a/.travis.yml +++ b/.travis.yml @@ -223,7 +223,7 @@ jobs: - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$? - | if [ "$BUILD_RC" -eq 0 ] ; then - mv pc-bios/s390-ccw/*.img pc-bios/ ; + mv pc-bios/s390-ccw/*.img qemu-bundle/usr/local/share/qemu ; ${TEST_CMD} ; else $(exit $BUILD_RC); diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build index 44247a12b5..2837eb34f4 100644 --- a/pc-bios/keymaps/meson.build +++ b/pc-bios/keymaps/meson.build @@ -40,9 +40,9 @@ else endif cp = find_program('cp') -t = [] -foreach km, args: keymaps - if native_qemu_keymap.found() +if native_qemu_keymap.found() + t = [] + foreach km, args: keymaps # generate with qemu-kvm t += custom_target(km, build_by_default: true, @@ -50,20 +50,11 @@ foreach km, args: keymaps command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()], install: true, install_dir: qemu_datadir / 'keymaps') - else - # copy from source tree - t += custom_target(km, - build_by_default: true, - input: km, - output: km, - command: [cp, '@INPUT@', '@OUTPUT@'], - install: true, - install_dir: qemu_datadir / 'keymaps') - endif -endforeach + endforeach -if native_qemu_keymap.found() alias_target('update-keymaps', t) +else + install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps') endif install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps') diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 41ba1c0ec7..388e0db6e4 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -85,16 +85,9 @@ blobs = [ 'vof-nvram.bin', ] -ln_s = [find_program('ln', required: true), '-sf'] -foreach f : blobs - roms += custom_target(f, - build_by_default: have_system, - output: f, - input: files('meson.build'), # dummy input - install: get_option('install_blobs'), - install_dir: qemu_datadir, - command: [ ln_s, meson.project_source_root() / 'pc-bios' / f, '@OUTPUT@' ]) -endforeach +if get_option('install_blobs') + install_data(blobs, install_dir: qemu_datadir) +endif subdir('descriptors') subdir('keymaps') diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh index aaf485cb55..2656a89aea 100755 --- a/scripts/oss-fuzz/build.sh +++ b/scripts/oss-fuzz/build.sh @@ -64,7 +64,7 @@ mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here # Build once to get the list of dynamic lib paths, and copy them over ../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \ - --prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \ + --prefix="/opt/qemu-oss-fuzz" \ --extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu" if ! make "-j$(nproc)" qemu-fuzz-i386; then @@ -81,14 +81,14 @@ if [ "$GITLAB_CI" != "true" ]; then # Build a second time to build the final binary with correct rpath ../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \ - --prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \ + --prefix="/opt/qemu-oss-fuzz" \ --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="-Wl,-rpath,\$ORIGIN/lib" \ --target-list="i386-softmmu" make "-j$(nproc)" qemu-fuzz-i386 V=1 fi -# Copy over the datadir -cp -r ../pc-bios/ "$DEST_DIR/pc-bios" +# Prepare a preinstalled tree +make install DESTDIR=$DEST_DIR/qemu-bundle targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}') base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)" diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 160cac999a..697cffea93 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -83,26 +83,6 @@ void qemu_add_data_dir(char *path) data_dir[data_dir_idx++] = path; } -/* - * Find a likely location for support files using the location of the binary. - * When running from the build tree this will be "$bindir/pc-bios". - * Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated). - * - * The caller must use g_free() to free the returned data when it is - * no longer required. - */ -static char *find_datadir(void) -{ - g_autofree char *dir = NULL; - - dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL); - if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { - return g_steal_pointer(&dir); - } - - return get_relocated_path(CONFIG_QEMU_DATADIR); -} - void qemu_add_default_firmwarepath(void) { char **dirs; @@ -116,7 +96,7 @@ void qemu_add_default_firmwarepath(void) g_strfreev(dirs); /* try to find datadir relative to the executable path */ - qemu_add_data_dir(find_datadir()); + qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR)); } void qemu_list_data_dirs(void) diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 0ad4ba9e94..2b3bc1fb9d 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -158,8 +158,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp) { char *target_name; - const char *bindir; - char *datadir; GString *cmd_line; gchar *pretty_cmd_line; bool serialize = false; @@ -174,22 +172,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp) target_name = strstr(**argv, "-target-"); if (target_name) { /* The binary name specifies the target */ target_name += strlen("-target-"); - /* - * With oss-fuzz, the executable is kept in the root of a directory (we - * cannot assume the path). All data (including bios binaries) must be - * in the same dir, or a subdir. Thus, we cannot place the pc-bios so - * that it would be in exec_dir/../pc-bios. - * As a workaround, oss-fuzz allows us to use argv[0] to get the - * location of the executable. Using this we add exec_dir/pc-bios to - * the datadirs. - */ - bindir = qemu_get_exec_dir(); - datadir = g_build_filename(bindir, "pc-bios", NULL); - if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) { - qemu_add_data_dir(datadir); - } else { - g_free(datadir); - } } else if (*argc > 1) { /* The target is specified as an argument */ target_name = (*argv)[1]; if (!strstr(target_name, "--fuzz-target=")) { From patchwork Thu Jul 14 09:01:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JhUx9pn+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8491xCSz9sB4 for ; Thu, 14 Jul 2022 19:16:09 +1000 (AEST) Received: from localhost ([::1]:35996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBux5-0008U2-4I for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujq-00053O-Mt for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujp-0005vt-6o for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uQMelrrZCdqb6pU7FgE8aWy1KpCK3c50YrAQsET7jbs=; b=JhUx9pn+mnCnGcasBTJzv3xg6tiCNWtJ3UnexhGOq3alzSFAkkCASstecRYbuE4ye3P0Gz TcSHc780dxhB/q9DLCQemKPsnCPf2HGEswPKutQWObDrzNn/vt36tViX0kE4L6I3cl3hfW uHi45D+ybctjMao2LlbdlUPnZTGvKFI= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-46-K37zrS7ANxKl2712PDqqfw-1; Thu, 14 Jul 2022 05:02:23 -0400 X-MC-Unique: K37zrS7ANxKl2712PDqqfw-1 Received: by mail-ej1-f69.google.com with SMTP id sh39-20020a1709076ea700b0072aa3156a68so498192ejc.19 for ; Thu, 14 Jul 2022 02:02:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uQMelrrZCdqb6pU7FgE8aWy1KpCK3c50YrAQsET7jbs=; b=C+lLQ0H7pyD/9wyHRBW1MYbxD8R4FzoOhgON37Qbb0Vih2qy5kSARtpg2Nfl+fwRvW geV2nPDGm+L6q1TFei4qPfG91NExAEDficZnAgXSAImeapJMyuBP0JFNgpuyPWKZBE9H 7m7FCHQx0uPeBTHEq6S452iJD8UKsBoiCY+0nlrwxuDD7mpgNGfcmK1Smm1QxUmByUUz UXMx9SEjROZcm5tXKLfRhtP53HZVLtJoIaZvA5BWJkEx0ABUBmXK09knEbnWm4WMjj4T iyhaVTXtNCICC3TYjbWZJeVLxxoj+7PRKpFPB9fS/KKvXF4zTyocua7BgapzFJCvshxd HOyQ== X-Gm-Message-State: AJIora9GMm4AQCg50KEMJkX88U/4I1WGbHtbSHz/cvKpwKAvEg2xhZWR FTQldN4Slj/3+xWCKVz27onrZTR6rHmIEcNGF9lu+GiwCszY/IvMFFuaeSSS8OzyHLSaBN/Q2tR QuFQ6ZPOOzLCPzyPYdKrnxhLE3WBHi5zf82nxkdXSD93LuyZjNf28h6wAxHe2GWaXN6A= X-Received: by 2002:a17:906:54c3:b0:6ef:d07b:c8ec with SMTP id c3-20020a17090654c300b006efd07bc8ecmr7356042ejp.687.1657789341806; Thu, 14 Jul 2022 02:02:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMmoWsYHiRjzd1YfWSO7F/YFTdKEDTzMlgPk3Hfae0oCCU7iWRwIELRbJSM8RjgdsPU/forg== X-Received: by 2002:a17:906:54c3:b0:6ef:d07b:c8ec with SMTP id c3-20020a17090654c300b006efd07bc8ecmr7356026ejp.687.1657789341521; Thu, 14 Jul 2022 02:02:21 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id x21-20020aa7d395000000b0043a21e3b4a5sm674097edq.40.2022.07.14.02.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 04/20] module: Use bundle mechanism Date: Thu, 14 Jul 2022 11:01:55 +0200 Message-Id: <20220714090211.304305-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki Before this change, the directory of the executable was being added to resolve modules in the build tree. However, get_relocated_path() can now resolve them with the new bundle mechanism. Signed-off-by: Akihiko Odaki Message-Id: <20220624145039.49929-5-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- util/module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/module.c b/util/module.c index 6bb4ad915a..8ddb0e18f5 100644 --- a/util/module.c +++ b/util/module.c @@ -274,7 +274,6 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail) dirs[n_dirs++] = g_strdup_printf("%s", search_dir); } dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR); - dirs[n_dirs++] = g_strdup(qemu_get_exec_dir()); #ifdef CONFIG_MODULE_UPGRADES version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION), From patchwork Thu Jul 14 09:01:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CKKf3/X3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7q042k3z9sB4 for ; Thu, 14 Jul 2022 19:04:44 +1000 (AEST) Received: from localhost ([::1]:47268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBum2-0005Aw-CH for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:04:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujx-00057R-1k for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujr-0005x5-IH for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W4D+E27LSCP3Js26+3lx8p9n1wgkYhKViXdqLLM1POA=; b=CKKf3/X3ZDldgNbWwebWEqw+kt7w4wEEq7EnvGVJn6RrjXpcyPq+W14I/uKaGysQIjcU+W iVNhF850C7qS42gwQqx1CfOXgnV/tov6jWGb5KfHTbD9PkfWBn3T1QPACo+AdSypF9LkBt wlILnBABraQiMaqYmb9dpsfKe2dv8a0= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-487-wMpRXltfNfWah_NmA4Rgfg-1; Thu, 14 Jul 2022 05:02:25 -0400 X-MC-Unique: wMpRXltfNfWah_NmA4Rgfg-1 Received: by mail-ed1-f69.google.com with SMTP id v19-20020a056402349300b0043b0f690cbaso1101708edc.11 for ; Thu, 14 Jul 2022 02:02:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W4D+E27LSCP3Js26+3lx8p9n1wgkYhKViXdqLLM1POA=; b=67rDbV213eF7hXAOFaiqm297TG7s5zR05+pDNPaXPSgm6j+1xVNVakDuO27zFeUERu hY5J0FofvlxXcjZwUOjoittkFencF5HhivowyimLOT007jCVbTKq1Nm8Y25kML5q+WhW ztRke9vhCF7LL6efJ16InF2fYdaJ4K3f93PDaqs7sblQEk76ucYs+SXph80ZcezP4hNK ph+mQHH7/ERO3uRsP82+L23UGtb7Y3LO4C+wesh9FxwtVgJZ8XMKak7GvEL/jmPl5xNS YLAG5s9gfUhABTo4Q1CMPajXEtT22fEjBFP5iaLG+GMeS5YUOL4hevM9feGQ5sPHOW1i AiRw== X-Gm-Message-State: AJIora9xeP/lbQJr/HkoZGpfn8vwS+P+XcgHeDCe/AlgdRfpB8KzFI2Q RFgVuhYKkIIcC9N1DJGM9moqzBo30fm74KiZ5cg0/gd8iBpR+R9EeR+TGZmhHE04nCO15lsDKcB jgV61m7IqTTOh2xTUlFDJIEkTZ7dWstuEzeqdPWrVipRUgtCUS1yGy7OKI4+1g1hfli0= X-Received: by 2002:a17:906:5a51:b0:72b:5cdf:ed77 with SMTP id my17-20020a1709065a5100b0072b5cdfed77mr7453477ejc.505.1657789343397; Thu, 14 Jul 2022 02:02:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uIAWY6UtTBQtdPjgV+uh1UXDKv+1LdFPFAW1BtwGEoVO9PUZgwphmp6SqYOBQ93TtSvFgNdw== X-Received: by 2002:a17:906:5a51:b0:72b:5cdf:ed77 with SMTP id my17-20020a1709065a5100b0072b5cdfed77mr7453450ejc.505.1657789343088; Thu, 14 Jul 2022 02:02:23 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id v18-20020a170906293200b007052b183d51sm447904ejd.132.2022.07.14.02.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 05/20] meson: Prefix each element of firmware path Date: Thu, 14 Jul 2022 11:01:56 +0200 Message-Id: <20220714090211.304305-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Akihiko Odaki Signed-off-by: Akihiko Odaki Message-Id: <20220624154042.51512-1-akihiko.odaki@gmail.com> [Rewrite shell function without using Bash extensions. - Paolo] Signed-off-by: Paolo Bonzini --- configure | 15 +++++++++++++++ meson.build | 11 +++++++++-- meson_options.txt | 2 +- scripts/meson-buildoptions.py | 7 +++++-- scripts/meson-buildoptions.sh | 4 ++-- softmmu/datadir.c | 8 +++++--- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/configure b/configure index e8cc850727..f02635b087 100755 --- a/configure +++ b/configure @@ -676,6 +676,21 @@ fi werror="" +meson_option_build_array() { + printf '[' + (if test "$targetos" == windows; then + IFS=\; + else + IFS=: + fi + for e in $1; do + e=${e/'\'/'\\'} + e=${e/\"/'\"'} + printf '"""%s""",' "$e" + done) + printf ']\n' +} + . $source_path/scripts/meson-buildoptions.sh meson_options= diff --git a/meson.build b/meson.build index da76edc7c7..ad16fc1aa8 100644 --- a/meson.build +++ b/meson.build @@ -1718,7 +1718,13 @@ config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix')) config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir) config_host_data.set_quoted('CONFIG_QEMU_DATADIR', get_option('prefix') / qemu_datadir) config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix') / qemu_desktopdir) -config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('prefix') / get_option('qemu_firmwarepath')) + +qemu_firmwarepath = '' +foreach k : get_option('qemu_firmwarepath') + qemu_firmwarepath += '"' + get_option('prefix') / k + '", ' +endforeach +config_host_data.set('CONFIG_QEMU_FIRMWAREPATH', qemu_firmwarepath) + config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') / get_option('libexecdir')) config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') / qemu_icondir) config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') / get_option('localedir')) @@ -3683,7 +3689,8 @@ endif summary_info = {} summary_info += {'Install prefix': get_option('prefix')} summary_info += {'BIOS directory': qemu_datadir} -summary_info += {'firmware path': get_option('prefix') / get_option('qemu_firmwarepath')} +pathsep = targetos == 'windows' ? ';' : ':' +summary_info += {'firmware path': pathsep.join(get_option('qemu_firmwarepath'))} summary_info += {'binary directory': get_option('prefix') / get_option('bindir')} summary_info += {'library directory': get_option('prefix') / get_option('libdir')} summary_info += {'module directory': qemu_moddir} diff --git a/meson_options.txt b/meson_options.txt index 9a034f875b..e58e158396 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,7 +6,7 @@ option('qemu_suffix', type : 'string', value: 'qemu', description: 'Suffix for QEMU data/modules/config directories (can be empty)') option('docdir', type : 'string', value : 'share/doc', description: 'Base directory for documentation installation (can be empty)') -option('qemu_firmwarepath', type : 'string', value : 'share/qemu-firmware', +option('qemu_firmwarepath', type : 'array', value : ['share/qemu-firmware'], description: 'search PATH for firmware files') option('pkgversion', type : 'string', value : '', description: 'use specified string as sub-version of the package') diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py index e624c16b01..3e2b478538 100755 --- a/scripts/meson-buildoptions.py +++ b/scripts/meson-buildoptions.py @@ -156,7 +156,7 @@ def cli_metavar(opt): if opt["type"] == "string": return "VALUE" if opt["type"] == "array": - return "CHOICES" + return "CHOICES" if "choices" in opt else "VALUES" return "CHOICE" @@ -199,7 +199,10 @@ def print_parse(options): key = cli_option(opt) name = opt["name"] if require_arg(opt): - print(f' --{key}=*) quote_sh "-D{name}=$2" ;;') + if opt["type"] == "array" and not "choices" in opt: + print(f' --{key}=*) quote_sh "-D{name}=$(meson_option_build_array $2)" ;;') + else: + print(f' --{key}=*) quote_sh "-D{name}=$2" ;;') elif opt["type"] == "boolean": print(f' --enable-{key}) printf "%s" -D{name}=true ;;') print(f' --disable-{key}) printf "%s" -D{name}=false ;;') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 4b7b8ffaa2..359b04e0e6 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -42,7 +42,7 @@ meson_options_help() { printf "%s\n" ' --enable-trace-backends=CHOICES' printf "%s\n" ' Set available tracing backends [log] (choices:' printf "%s\n" ' dtrace/ftrace/log/nop/simple/syslog/ust)' - printf "%s\n" ' --firmwarepath=VALUE search PATH for firmware files [share/qemu-firmware]' + printf "%s\n" ' --firmwarepath=VALUES search PATH for firmware files [share/qemu-firmware]' printf "%s\n" ' --iasl=VALUE Path to ACPI disassembler' printf "%s\n" ' --includedir=VALUE Header file directory [include]' printf "%s\n" ' --interp-prefix=VALUE where to find shared libraries etc., use %M for' @@ -363,7 +363,7 @@ _meson_option_parse() { --disable-qcow1) printf "%s" -Dqcow1=disabled ;; --enable-qed) printf "%s" -Dqed=enabled ;; --disable-qed) printf "%s" -Dqed=disabled ;; - --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$2" ;; + --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;; --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;; --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;; --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;; diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 697cffea93..c9237cb5d4 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -85,15 +85,17 @@ void qemu_add_data_dir(char *path) void qemu_add_default_firmwarepath(void) { - char **dirs; + static const char * const dirs[] = { + CONFIG_QEMU_FIRMWAREPATH + NULL + }; + size_t i; /* add configured firmware directories */ - dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0); for (i = 0; dirs[i] != NULL; i++) { qemu_add_data_dir(get_relocated_path(dirs[i])); } - g_strfreev(dirs); /* try to find datadir relative to the executable path */ qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR)); From patchwork Thu Jul 14 09:01:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QgVBIt1g; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8CJ2YvYz9sB4 for ; Thu, 14 Jul 2022 19:22:20 +1000 (AEST) Received: from localhost ([::1]:48400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv34-0000Pq-5e for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:22:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk4-0005At-MC for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujr-0005xH-Tw for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tjKHpLIVumBSTxBZ1CWWpToSuqh+RlvwbX3C7GG0ObQ=; b=QgVBIt1g5cl5mPFGHyf68paZhz+7Hz4fhY903IjY9pWBc3O8xUOX/MAUhDGtq603B6DOMB f2BGC/wnaYgOYZnGyCjmzStPZFHG02fT9s6NvNc1AM2ENmrA+s/WncVEjKYgjM1OtbAaaG d2y1rmQWer825fzdO3h7n6frXgJ8yWU= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-GkAc2az2MkGxoD1G15uZWw-1; Thu, 14 Jul 2022 05:02:26 -0400 X-MC-Unique: GkAc2az2MkGxoD1G15uZWw-1 Received: by mail-ej1-f72.google.com with SMTP id qk18-20020a1709077f9200b0072b95d9eea3so502294ejc.4 for ; Thu, 14 Jul 2022 02:02:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tjKHpLIVumBSTxBZ1CWWpToSuqh+RlvwbX3C7GG0ObQ=; b=hFdC7O/E7OUCOoI10fMxbnP7unvepo4NFS/7XBYlt7bRqmYcB7yzNp1RLDbRd1wJZR 5t2Vwca1TzIPsyhbjsJ6lb1u/LYdRpd5qT43KS2sAdZWi/5y08WXWFeUwFgdo+hnuW9z gSrDSjtyQviTTBB6QloX4nhqRoiqsyV1PLiBQVO8qPx9ocxqT5r9NjMYWK8mityNnCh+ a+1aUWqHzwk2ds6tczUmKfcbwhXVU/G80hXtY8cFNuIakuCmZg4XpTJMIqHmOQiM/Tku ZSbu97BSSMCZYaXUVf5nli7V1NmeWCGb0mBTRRW58wlFnBb4J0RvUBVgS8cxhCXGCQBs +u1g== X-Gm-Message-State: AJIora9rHE8doGsHIqT5yoUWXEiJsHpAjNnsS33yvJCVDFAhVTqBdUfK at/UvI8yP2ADYJV2ANZWRx0OHFw003pPSqDrCqrQSII6zvk+hFZ9Vlf4e1Aq+7Eq3KduBdFLGyo iXvsDEqlxBf8PgSHAR1GBk1GONXsu0szDfq3iHoPuWgMb0i8V9vIYJacMPGRB9i912c4= X-Received: by 2002:a05:6402:4490:b0:43a:8f5a:d273 with SMTP id er16-20020a056402449000b0043a8f5ad273mr10737285edb.6.1657789344737; Thu, 14 Jul 2022 02:02:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uydJ1sfoyQ0mun/nraehcbkOVcOd0rDHiQCD2dtvRWFgXLeNvA+6kLKKPdC2Q5qm3gQS155A== X-Received: by 2002:a05:6402:4490:b0:43a:8f5a:d273 with SMTP id er16-20020a056402449000b0043a8f5ad273mr10737255edb.6.1657789344492; Thu, 14 Jul 2022 02:02:24 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id uh40-20020a170906b3a800b0072ab06bc3b5sm456732ejc.34.2022.07.14.02.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier Subject: [PULL 06/20] scsi-disk: add new quirks bitmap to SCSIDiskState Date: Thu, 14 Jul 2022 11:01:57 +0200 Message-Id: <20220714090211.304305-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Since the MacOS SCSI implementation is quite old (and Apple added some firmware customisations to their drives for m68k Macs) there is need to add a mechanism to correctly handle Apple-specific quirks. Add a new quirks bitmap to SCSIDiskState that can be used to enable these features as required. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20220622105314.802852-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 91acb5c0ce..55c19fb25d 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -94,6 +94,7 @@ struct SCSIDiskState { uint16_t port_index; uint64_t max_unmap_size; uint64_t max_io_size; + uint32_t quirks; QEMUBH *bh; char *version; char *serial; From patchwork Thu Jul 14 09:01:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aBj8nkph; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk80m28qcz9sB4 for ; Thu, 14 Jul 2022 19:13:12 +1000 (AEST) Received: from localhost ([::1]:60256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBuuD-0005m4-Pk for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:13:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuju-00056Q-Uu for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujt-0005xx-BZ for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AI8wES1qKseyfvJptO7VtOVvhwLXSQUcnqOlBIz2DAs=; b=aBj8nkph9HnZdiSS5KH8rOk2TyAORnMwH7Usf+hoaby07pUuYW5Vz2N/A1QaNrOW1U9p/h celFatpoH30pyAYZqltr6/VIFmCteYtFamxKisEfxL02uP+ft2ktYml16+D9wuWFY4ASvl 091ojtfSvtord4QPMvSf3Z+TFYHXkG4= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-304-IOQFiGr2OtuyHVnDgG6k_Q-1; Thu, 14 Jul 2022 05:02:27 -0400 X-MC-Unique: IOQFiGr2OtuyHVnDgG6k_Q-1 Received: by mail-ed1-f70.google.com with SMTP id m10-20020a056402510a00b0043a93d807ffso1096625edd.12 for ; Thu, 14 Jul 2022 02:02:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AI8wES1qKseyfvJptO7VtOVvhwLXSQUcnqOlBIz2DAs=; b=rro8B+B8v5fqQ9gKH6pGCbS/YDnxn5vvau5ONhnnftEAm9UryJihspWI0K5nxu1W7T u0lwJdkPsgLml+M/NrXCefveu0bbr+3ZID8QpZfrFVR0pCW3XvIsSMwDCa5OhXMmvTlx 1jNbH7d4DGainTWpH5xMtaBDyBa4CuO8MAOKZax0Qba/noaC/SXSnIz77c052toHnPQx 3OLK/agNm1aji5feZZSJDLU4ia7PJlOgomiLMLDLLGrIVostqOIZNd3DoCUhQrHw44vv 88BVF5+qxuEXu+Yc4w4b8m5QqOqLFR2N40TMPXpWgKSHghKIE9N5DtIoV4YEK4FVwyb9 8RUQ== X-Gm-Message-State: AJIora+WGqnF8dnh3biPeWIs0uwNCEBG2rCqAE28qlc4kRfvDhpUUFPg rkidevReOo4cr4ON/S+1SdttS8pZ99ooDtcXeaigBOaskbS8j4bYwcQKM+u70TfSh3Gb31+3TMc F/bpIJRagx4gwLB4Hk6X04+s+NNbnizooikS0JqWt2Pi/DN+3EzU9XQZcsf7QX3gSdmg= X-Received: by 2002:a17:907:d26:b0:72b:8311:a167 with SMTP id gn38-20020a1709070d2600b0072b8311a167mr7642624ejc.89.1657789346198; Thu, 14 Jul 2022 02:02:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKraSLNTRrNBTUN//00744IvgmiiQwCuXcV23BBtaf0/7kwmgT3wtf6yPZ1UwddSb2JsIw7w== X-Received: by 2002:a17:907:d26:b0:72b:8311:a167 with SMTP id gn38-20020a1709070d2600b0072b8311a167mr7642596ejc.89.1657789345912; Thu, 14 Jul 2022 02:02:25 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id z16-20020a1709064e1000b006fe9f9d0938sm452008eju.175.2022.07.14.02.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier Subject: [PULL 07/20] scsi-disk: add MODE_PAGE_APPLE_VENDOR quirk for Macintosh Date: Thu, 14 Jul 2022 11:01:58 +0200 Message-Id: <20220714090211.304305-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland One of the mechanisms MacOS uses to identify CDROM drives compatible with MacOS is to send a custom MODE SELECT command for page 0x30 to the drive. The response to this is a hard-coded manufacturer string which must match in order for the CDROM to be usable within MacOS. Add an implementation of the MODE SELECT page 0x30 response guarded by a newly defined SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR quirk bit so that CDROM drives attached to non-Apple machines function exactly as before. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20220622105314.802852-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 17 +++++++++++++++++ include/hw/scsi/scsi.h | 3 +++ include/scsi/constants.h | 1 + 3 files changed, 21 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 55c19fb25d..2672730eca 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1085,6 +1085,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, [MODE_PAGE_R_W_ERROR] = (1 << TYPE_DISK) | (1 << TYPE_ROM), [MODE_PAGE_AUDIO_CTL] = (1 << TYPE_ROM), [MODE_PAGE_CAPABILITIES] = (1 << TYPE_ROM), + [MODE_PAGE_APPLE_VENDOR] = (1 << TYPE_ROM), }; uint8_t *p = *p_outbuf + 2; @@ -1229,6 +1230,20 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, p[19] = (16 * 176) & 0xff; break; + case MODE_PAGE_APPLE_VENDOR: + if (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR)) { + length = 0x1e; + if (page_control == 1) { /* Changeable Values */ + break; + } + + memset(p, 0, length); + strcpy((char *)p + 8, "APPLE COMPUTER, INC "); + break; + } else { + return -1; + } + default: return -1; } @@ -3085,6 +3100,8 @@ static Property scsi_cd_properties[] = { DEFAULT_MAX_IO_SIZE), DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, 5), + DEFINE_PROP_BIT("quirk_mode_page_apple_vendor", SCSIDiskState, quirks, + SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 1ffb367f94..e090ea1b40 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -226,4 +226,7 @@ SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun); /* scsi-generic.c. */ extern const SCSIReqOps scsi_generic_req_ops; +/* scsi-disk.c */ +#define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 + #endif diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 2a32c08b5e..891aa0f45c 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -234,6 +234,7 @@ #define MODE_PAGE_FAULT_FAIL 0x1c #define MODE_PAGE_TO_PROTECT 0x1d #define MODE_PAGE_CAPABILITIES 0x2a +#define MODE_PAGE_APPLE_VENDOR 0x30 #define MODE_PAGE_ALLS 0x3f /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor * of MODE_PAGE_SENSE_POWER */ From patchwork Thu Jul 14 09:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H60yFxbo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7zp5DKmz9sB4 for ; Thu, 14 Jul 2022 19:12:22 +1000 (AEST) Received: from localhost ([::1]:58492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oButQ-0004WZ-FD for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk0-00057T-Ju for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujw-0005z9-P5 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=USfF9RVAdTE+tkNnR84GQNeWwGHl3N/1116YVhz6nHg=; b=H60yFxboq6rRbRBKjw+JS7jjAsBBQScLlG7jKWu9mwNeL0sVeDMjTPn0ObdTJxfSwDeb1v JqB/5VZ9wmqisC862L4uj+6b7AkA205pPFBvDnKAXs0cQfdKZHAbk/U57oCbya/EibXYGq Avx7UbbwVLLPrBBx5mAEH+hlklxuuaA= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-ug5qrno5Nnycuf51REDsDA-1; Thu, 14 Jul 2022 05:02:29 -0400 X-MC-Unique: ug5qrno5Nnycuf51REDsDA-1 Received: by mail-ej1-f69.google.com with SMTP id nc23-20020a1709071c1700b0072b94109144so508355ejc.2 for ; Thu, 14 Jul 2022 02:02:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=USfF9RVAdTE+tkNnR84GQNeWwGHl3N/1116YVhz6nHg=; b=xtbX8dSlcjx3qs/ufDPOPsi1JQbNKSF+KWIiq2v8Fx2RIFDY3YHZV3fHfqrTxkj0O+ DNNsssTSBf70AO+nbCRNnyskXVHul814Rh7ZiUqTsmU1Akn+jP388kDCiMcmFXrJstDk /5wnnwqNzQevJ+UHVEDWn/DenoKsxfuZJ2xf98i6xy7Gs6k3hhnkwdTr6cvtXD4mE2Dj IxvPF/G53T6sVlBBHeRS7BPTxsb3XF/EI6/cQisf7yliStlvXAywsg3QFXAtznHpo5mu pNRje07X/AKYVP6E/t7rPjiK+zD3z20PRTB3nZeHV+nTmYPC2e2LFkaAUU5LMFRBE423 CooQ== X-Gm-Message-State: AJIora+zMVval6Zs3ryAjvk8gf77Wwv68rm4KMRuNfEvmq/ivDX4Ql8c Yc27ug0+O0b7XEr2+SxZIz194V6arGMKBl/AxcD2FYcPHQG3E/oRg18mldtT43S/bF6UH7YmmFV cyGdtEOaKTXV+tn7LjpRy7gL7Oo/ifHI0c29JCfZS7TNsM3ZSGNA30ekx+CNkxHgwWO4= X-Received: by 2002:a05:6402:150d:b0:43a:2cac:ca24 with SMTP id f13-20020a056402150d00b0043a2cacca24mr10918791edw.110.1657789347958; Thu, 14 Jul 2022 02:02:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBLhCN8SoRHQG/0mjZY/MsDnVbORFp6Z/4ysECx1GpzGqsU9viLCjpaJBWU+Wx5645Rk1RmA== X-Received: by 2002:a05:6402:150d:b0:43a:2cac:ca24 with SMTP id f13-20020a056402150d00b0043a2cacca24mr10918760edw.110.1657789347616; Thu, 14 Jul 2022 02:02:27 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id ku5-20020a170907788500b007262a5e2204sm450019ejc.153.2022.07.14.02.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 08/20] q800: implement compat_props to enable quirk_mode_page_apple_vendor for scsi-cd devices Date: Thu, 14 Jul 2022 11:01:59 +0200 Message-Id: <20220714090211.304305-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland By default quirk_mode_page_apple_vendor should be enabled for all scsi-cd devices connected to the q800 machine to enable MacOS to detect and use them. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 099a758c6f..6fabd35529 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -686,6 +686,11 @@ static void q800_init(MachineState *machine) } } +static GlobalProperty hw_compat_q800[] = { + { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, +}; +static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); + static void q800_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -695,6 +700,7 @@ static void q800_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = 1; mc->block_default_type = IF_SCSI; mc->default_ram_id = "m68k_mac.ram"; + compat_props_add(mc->compat_props, hw_compat_q800, hw_compat_q800_len); } static const TypeInfo q800_machine_typeinfo = { From patchwork Thu Jul 14 09:02:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656301 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TTxdZ24V; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk875240Xz9sB4 for ; Thu, 14 Jul 2022 19:18:41 +1000 (AEST) Received: from localhost ([::1]:40258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBuzW-0003Ae-S5 for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:18:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk2-00059T-3L for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBujz-0005zF-7N for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U7BNvbDIkbI1uaiLP0zumbSGvEEG4aAJrNM+lpwoDsQ=; b=TTxdZ24VLz01MDBv6kwsmJX6RAnMW8vXE12jz8+GFMySAR7UC5v9vkkJ3KMazUXD/72pxP 0LjivqMhIaHuway98Gs6Uq/4Fl9fRlglTPaPs5zp1ODgjOU64I2dOIoxZqf1p6m5r3t49l Vf+JSCYgoqNAkvYRaw/KZFi+7ytdzXc= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-rK3aZyAJNwKf5OXIGCmzpw-1; Thu, 14 Jul 2022 05:02:31 -0400 X-MC-Unique: rK3aZyAJNwKf5OXIGCmzpw-1 Received: by mail-ej1-f72.google.com with SMTP id sc42-20020a1709078a2a00b0072b5f51a9dbso509546ejc.1 for ; Thu, 14 Jul 2022 02:02:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U7BNvbDIkbI1uaiLP0zumbSGvEEG4aAJrNM+lpwoDsQ=; b=2fg4wkGT+WleiFIpZFoXqpeZ43FAXMBHKuVvQlZJp9ArZhaqvAA8let+g/239yKWd0 9OZXDs0KTMO/toQ6U8kVY1k1XpxAXE77WdY6pNsEc28G9yrUFZFtyyOzP0Rvdbli7ObO a7IxfGQgGZ3xP+Wq/GdnTDK4Fo/ru3jYmncC2Fg6WYl2XZCEtDB0E3zJJVGs3s1rR+dK 4ctLlFErt0dXOhjj8+rFFMHcC5K/FrRu0S6vfiA+ZLLxvmiopPbO6xisyCSxZq+Q/rd6 FQHUSWslk2U7VPhcnzL9jttCVKGKrGrS4Wh2CaRDcsTtbKEf49QrDPYTrQN9mTmgm6pu qKnQ== X-Gm-Message-State: AJIora8+IkgBiHbonPJAq5PS18QtEiSLxGVesqYxDziFE6rYQP5pfxSl AklT1OFrUV/pxKOBowNHeGu5zADqIVaAIJgFrIp2Ri5L2Fh7ssJkdk0WrwELjVqUjKynhUggKGc L4lD7z0YwowBG5sR2EdMGQTryGbZ7kdgeQwPAULAQY6H9BWeMm3csid2hQgZqQK2ovnQ= X-Received: by 2002:a17:907:728c:b0:72b:995f:78d with SMTP id dt12-20020a170907728c00b0072b995f078dmr7700974ejc.348.1657789349672; Thu, 14 Jul 2022 02:02:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1slU3L+Ymn2F2IUeTVbBq+1Nq6qRAje0KJQsKVZtzFqPfJQmH4KuoXDWFGxonoelyc0oEyZCQ== X-Received: by 2002:a17:907:728c:b0:72b:995f:78d with SMTP id dt12-20020a170907728c00b0072b995f078dmr7700944ejc.348.1657789349236; Thu, 14 Jul 2022 02:02:29 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id m9-20020a1709060d8900b0072af6f166c2sm460560eji.82.2022.07.14.02.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 09/20] scsi-disk: add SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD quirk for Macintosh Date: Thu, 14 Jul 2022 11:02:00 +0200 Message-Id: <20220714090211.304305-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland During SCSI bus enumeration A/UX sends a MODE SENSE command to the CDROM with the DBD bit unset and expects the response to include a block descriptor. As per the latest SCSI documentation, QEMU currently force-disables the block descriptor for CDROM devices but the A/UX driver expects the requested block descriptor to be returned. If the block descriptor is not returned in the response then A/UX becomes confused, since the block descriptor returned in the MODE SENSE response is used to generate a subsequent MODE SELECT command which is then invalid. Add a new SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD quirk to allow this behaviour to be enabled as required. Note that an additional workaround is required for the previous SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR quirk which must never return a block descriptor even though the DBD bit is left unset. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-5-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 27 +++++++++++++++++++++++---- include/hw/scsi/scsi.h | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 2672730eca..b1d08bfba5 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1279,10 +1279,27 @@ static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf) dev_specific_param |= 0x80; /* Readonly. */ } } else { - /* MMC prescribes that CD/DVD drives have no block descriptors, - * and defines no device-specific parameter. */ - dev_specific_param = 0x00; - dbd = true; + if (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD)) { + /* Use DBD from the request... */ + dev_specific_param = 0x00; + + /* + * ... unless we receive a request for MODE_PAGE_APPLE_VENDOR + * which should never return a block descriptor even though DBD is + * not set, otherwise CDROM detection fails in MacOS + */ + if (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR) && + page == MODE_PAGE_APPLE_VENDOR) { + dbd = true; + } + } else { + /* + * MMC prescribes that CD/DVD drives have no block descriptors, + * and defines no device-specific parameter. + */ + dev_specific_param = 0x00; + dbd = true; + } } if (r->req.cmd.buf[0] == MODE_SENSE) { @@ -3102,6 +3119,8 @@ static Property scsi_cd_properties[] = { 5), DEFINE_PROP_BIT("quirk_mode_page_apple_vendor", SCSIDiskState, quirks, SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR, 0), + DEFINE_PROP_BIT("quirk_mode_sense_rom_use_dbd", SCSIDiskState, quirks, + SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index e090ea1b40..845d05722b 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -228,5 +228,6 @@ extern const SCSIReqOps scsi_generic_req_ops; /* scsi-disk.c */ #define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 +#define SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD 1 #endif From patchwork Thu Jul 14 09:02:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MPHLuEo8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk84671vLz9sB4 for ; Thu, 14 Jul 2022 19:16:05 +1000 (AEST) Received: from localhost ([::1]:35872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBux0-0008P9-4j for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:16:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk3-0005AD-Aq for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk0-0005zR-Eo for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MoYKiEEJm6JRUCi1cJ1l0HlCPpVMg2FcXoSJlIy3vcc=; b=MPHLuEo8Il5gJhsDZ/6fjg6sUHUjiOtKICCa0sLSkBjQ069/oAVhY71/KAxQu8aNzV/3dz h5VgyuE3Rbx45e4fcFMqmBjbqU6Jhaa7qxIsC/b+s7QmCVwTwmKQrpb1j9maD0DZ/eZKLV /n4Wee1Tj6sHOoh/WODTNKrH9JBTsBU= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-169-9bdow5s3MzyTweaTCZcJoA-1; Thu, 14 Jul 2022 05:02:32 -0400 X-MC-Unique: 9bdow5s3MzyTweaTCZcJoA-1 Received: by mail-ed1-f71.google.com with SMTP id s17-20020a056402521100b0043ade613038so1082645edd.17 for ; Thu, 14 Jul 2022 02:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MoYKiEEJm6JRUCi1cJ1l0HlCPpVMg2FcXoSJlIy3vcc=; b=VRhD/gpcVIfmD5PtIql1VS4/H0vfNgSzCJlaJ9lEglHILMptI1P/TywLuLeszPu+PC fCMQ8tVE5eX7PBGbEjkq4FmuxOUaVPXCYga9JYyPHJhXn05xZ5EaVZvKpax57pvkQRTt IZW8hkh+ijflVC8Kp8yu5lxLbC9wXgYCcZ2fY9MBx/PhCgpxcsgzmaiIhMq1lvvfA2Qd p1LVuE59fRWq0wBs0/9K2rAR6pPbWoTJ1W4e8ePAlHdnxsGgGxphXkzIhAQYWGa+xJJQ aKqUp1AE+D/PQlsa2k5DPjgDx4dHuVQOZyZ8nDHNX+oK97UcxNKAC7GPC4BAsJxrxXr2 Y1gQ== X-Gm-Message-State: AJIora/ebHdN6Ip3QhxmD/jyreObC44Q9FDbFU9WWqVHS2BXcaKGs909 jLgARR1pU8mVnhl2k9AiKlza7Wi87zeBhyWp1p1TRa3wV8AGjjePVDibnfOV1Nk0bq4erg31exl oL5wyL24NwRD2hMv53HJDzw+dlmekrUh/jx5P92LgoZcU9/ymBjWpiM3QiJlWPuSbzhc= X-Received: by 2002:a17:907:7292:b0:726:95e4:5a21 with SMTP id dt18-20020a170907729200b0072695e45a21mr7734937ejc.266.1657789351105; Thu, 14 Jul 2022 02:02:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vWosh1VSrV2uOGG89cgFw7FhPty7h+kotuez+p7VYVLLFQi8civ4DmY5wT7BnRLiN9k6atUA== X-Received: by 2002:a17:907:7292:b0:726:95e4:5a21 with SMTP id dt18-20020a170907729200b0072695e45a21mr7734922ejc.266.1657789350852; Thu, 14 Jul 2022 02:02:30 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id s26-20020aa7cb1a000000b0043574d27ddasm684888edt.16.2022.07.14.02.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier Subject: [PULL 10/20] q800: implement compat_props to enable quirk_mode_sense_rom_use_dbd for scsi-cd devices Date: Thu, 14 Jul 2022 11:02:01 +0200 Message-Id: <20220714090211.304305-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland By default quirk_mode_sense_rom_use_dbd should be enabled for all scsi-cd devices connected to the q800 machine to correctly report the CDROM block descriptor back to A/UX. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20220622105314.802852-6-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 6fabd35529..4745f72c92 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -688,6 +688,7 @@ static void q800_init(MachineState *machine) static GlobalProperty hw_compat_q800[] = { { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, + { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, }; static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); From patchwork Thu Jul 14 09:02:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NtIW3gE+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk7yG0ZFpz9sB4 for ; Thu, 14 Jul 2022 19:11:00 +1000 (AEST) Received: from localhost ([::1]:55788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBus6-0002g0-N0 for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk2-00059U-4K for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk0-0005zb-Eb for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cU4DWCKiVZhQ9j8g5YUlKqIkekzW14p85YKTJ5Ocap4=; b=NtIW3gE+ZeJ5ZseBIbJxOWdk9pIGdwUe+XKPVmk86wkbj4GnaL7iQcv6dBbAPwyJ3+lkNJ uyd0xbY8uS7GHpJJLDxKG5GrSPN8Hox5gb6Q5w9Cvda/IFIGWjZaOkZgm7fXlHMpAGBsNL psIQjqkWH0itrnGOjWRmJAvXSu5ntgc= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-10-tdz3ZAiQPyyj8T1Wkk8gsg-1; Thu, 14 Jul 2022 05:02:34 -0400 X-MC-Unique: tdz3ZAiQPyyj8T1Wkk8gsg-1 Received: by mail-ed1-f69.google.com with SMTP id y21-20020a056402359500b0043adf65d1a0so1104632edc.10 for ; Thu, 14 Jul 2022 02:02:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cU4DWCKiVZhQ9j8g5YUlKqIkekzW14p85YKTJ5Ocap4=; b=AnNCqibwtNTA/dBI/uLMRTZB1SMOaoRwjblDVP7ZlECrOL7PV6/ZL6JZOLpRT73I51 PpyBAMWfZwLwjz0U/v3d6w89a1Wt2JlBfdA56kHGu5/YZNySIGt17VCV4lgSM7qOmFZO 9ajjl4omXD1OL0sUcGa+4mwm15Bl5+bvc0wGssb3hwXUA6jpl953QP1Mq5g470IBzepW Bl1uVYKAW39SrK7PQglz1YZoBmzjWfERvH5ymd6mX6kuGqory1fw5p/KfcaKDK286IcA PBiS3MtND02DTmCtpPTHTMqWg5+D6xyrbac4CB7bt86PfodtLhNXVALE+QA5foB07pzi 5jOw== X-Gm-Message-State: AJIora8ygmb0brkEL7+kRkqyI6/iX/WyRqGvn4g2nHznKKPPO5ywDFmP 3pDcAogceyu432+pnQRf5dv1AmridpTA0NTLez4dx4htfebgtKdfXK/eIGLWn7b2n3FrLiPakGV jpv3RKgY/ng1EIDfn55rvpnWU4IV46EJ/fEO3BEYMywtPzUQa6SQ9CxPX1H6OzPdUPD4= X-Received: by 2002:aa7:d5d7:0:b0:43a:6eda:464a with SMTP id d23-20020aa7d5d7000000b0043a6eda464amr10875715eds.193.1657789352635; Thu, 14 Jul 2022 02:02:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQYejmBmBE0gfP8eTyCBALNiH58W72j56KOr40muK6MAI663vyL+nS4TD6UFaIi+9xLo/X4w== X-Received: by 2002:aa7:d5d7:0:b0:43a:6eda:464a with SMTP id d23-20020aa7d5d7000000b0043a6eda464amr10875687eds.193.1657789352331; Thu, 14 Jul 2022 02:02:32 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id n6-20020aa7c786000000b0043787ad7cfasm682359eds.22.2022.07.14.02.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 11/20] scsi-disk: add SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE quirk for Macintosh Date: Thu, 14 Jul 2022 11:02:02 +0200 Message-Id: <20220714090211.304305-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland Both MacOS and A/UX make use of vendor-specific MODE SELECT commands with PF=0 to identify SCSI devices: - MacOS sends a MODE SELECT command with PF=0 for the MODE_PAGE_VENDOR_SPECIFIC (0x0) mode page containing 2 bytes before initialising a disk - A/UX (installed on disk) sends a MODE SELECT command with PF=0 during SCSI bus enumeration, and gets stuck in an infinite loop if it fails Add a new SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE quirk to allow both PF=0 MODE SELECT commands and implement a MODE_PAGE_VENDOR_SPECIFIC (0x0) mode page which is compatible with MacOS. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-7-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 30 ++++++++++++++++++++++++++++-- include/hw/scsi/scsi.h | 1 + include/scsi/constants.h | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index b1d08bfba5..2cdbba7ccc 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1079,6 +1079,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, int page_control) { static const int mode_sense_valid[0x3f] = { + [MODE_PAGE_VENDOR_SPECIFIC] = (1 << TYPE_DISK) | (1 << TYPE_ROM), [MODE_PAGE_HD_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_FLEXIBLE_DISK_GEOMETRY] = (1 << TYPE_DISK), [MODE_PAGE_CACHING] = (1 << TYPE_DISK) | (1 << TYPE_ROM), @@ -1244,6 +1245,22 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, return -1; } + case MODE_PAGE_VENDOR_SPECIFIC: + if (s->qdev.type == TYPE_DISK && (s->quirks & + (1 << SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE))) { + length = 0x2; + if (page_control == 1) { /* Changeable Values */ + p[0] = 0xff; + p[1] = 0xff; + break; + } + p[0] = 0; + p[1] = 0; + break; + } else { + return -1; + } + default: return -1; } @@ -1570,9 +1587,12 @@ static void scsi_disk_emulate_mode_select(SCSIDiskReq *r, uint8_t *inbuf) int bd_len; int pass; - /* We only support PF=1, SP=0. */ if ((r->req.cmd.buf[1] & 0x11) != 0x10) { - goto invalid_field; + if (!(s->quirks & + (1 << SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE))) { + /* We only support PF=1, SP=0. */ + goto invalid_field; + } } if (len < hdr_len) { @@ -3069,6 +3089,9 @@ static Property scsi_hd_properties[] = { DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, 5), + DEFINE_PROP_BIT("quirk_mode_page_vendor_specific_apple", SCSIDiskState, + quirks, SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE, + 0), DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf), DEFINE_PROP_END_OF_LIST(), }; @@ -3121,6 +3144,9 @@ static Property scsi_cd_properties[] = { SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR, 0), DEFINE_PROP_BIT("quirk_mode_sense_rom_use_dbd", SCSIDiskState, quirks, SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD, 0), + DEFINE_PROP_BIT("quirk_mode_page_vendor_specific_apple", SCSIDiskState, + quirks, SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE, + 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 845d05722b..011cb84753 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -229,5 +229,6 @@ extern const SCSIReqOps scsi_generic_req_ops; /* scsi-disk.c */ #define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 #define SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD 1 +#define SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE 2 #endif diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 891aa0f45c..6a8bad556a 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -225,6 +225,7 @@ #define TYPE_NO_LUN 0x7f /* Mode page codes for mode sense/set */ +#define MODE_PAGE_VENDOR_SPECIFIC 0x00 #define MODE_PAGE_R_W_ERROR 0x01 #define MODE_PAGE_HD_GEOMETRY 0x04 #define MODE_PAGE_FLEXIBLE_DISK_GEOMETRY 0x05 From patchwork Thu Jul 14 09:02:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FLLlSu9h; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8BG5gv5z9sB4 for ; Thu, 14 Jul 2022 19:21:25 +1000 (AEST) Received: from localhost ([::1]:46524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv29-0007YQ-G9 for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:21:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk8-0005DG-Cb for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk1-0005zp-Sg for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4H00/Y902lyrfox7E+/FrDYoSe9D5v5iihKAKWBtn8=; b=FLLlSu9hJLFEYGNgU9dFoze8CGBjzqA/LxcUhu8iVoF+Xl9xDtdG1HM65vBuSyaLioxFuL C0kqEscURRm89YqWVZCENl368097yi8D2q4VdVtFfWE+MyB4pcPac32xDOZWXee0AU5PYe WtUOPtSsygGoDjty6wvjgO2BlFV7fVA= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-pbER3D87OI-5ISv6j3ajaA-1; Thu, 14 Jul 2022 05:02:35 -0400 X-MC-Unique: pbER3D87OI-5ISv6j3ajaA-1 Received: by mail-ej1-f72.google.com with SMTP id sg42-20020a170907a42a00b0072e3fc6cdd1so503067ejc.13 for ; Thu, 14 Jul 2022 02:02:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V4H00/Y902lyrfox7E+/FrDYoSe9D5v5iihKAKWBtn8=; b=h629oBBup4Ha4HsMT3aqnnE0JfXX4SiMJT5OQcaWQjJNX1aBdOOGeydFtVbmbI7JBB riomJSP8qEc6Z1gouEbyO9VoesH1XEmEpyjPDSskExt0CHaLwClNLSFw4dIf8/N2dwLf u7AN04GEu8n/7LO+BtNiL/b5aSDBrb/6HmuwSfHVXRwZ6kjG3Om3QN4VaHP5E+dUPfqu rJ/nRsAsWM7B816va+Azl0rnj37ZGAEdrO38tb9rcEnNGne1ZIMKswlJU+ok1jvRYa2d ll3X0KTykdw2dl5zlCPlwt1JoAve9sqGJn7/1+adxZbKUD/x5TnrID1vP+Twcsb7aitd LvxQ== X-Gm-Message-State: AJIora9Ww1gcqt89ADm0W0J5j6Vh5usVxbE0iZ8xX9yc2hmAYaAZezvo iSgmqIHuyxyZkrfewF+uPJpSwlb0UkZbtAQVNxNsEQf9Dxo8OEifrhAwXFtLKcxzmgwPIzj7Pfj wIZGCDEenuWtXRuk8BxyUrSoiPSegnrjdzGR5zmaf93Ad4vWi+lJh1B/C+miBOiUELQ0= X-Received: by 2002:a17:907:2705:b0:72b:4ef4:2d91 with SMTP id w5-20020a170907270500b0072b4ef42d91mr7602385ejk.95.1657789354330; Thu, 14 Jul 2022 02:02:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRYbc4rbrJN1eMcjtynPMVxTF8BKSBb1I879Hc2PwfIEm6AA1cWTR+AaPd58WKuzxdvyrNlg== X-Received: by 2002:a17:907:2705:b0:72b:4ef4:2d91 with SMTP id w5-20020a170907270500b0072b4ef42d91mr7602355ejk.95.1657789353989; Thu, 14 Jul 2022 02:02:33 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id o7-20020aa7c507000000b0043ab81e4230sm690304edq.50.2022.07.14.02.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 12/20] q800: implement compat_props to enable quirk_mode_page_vendor_specific_apple for scsi devices Date: Thu, 14 Jul 2022 11:02:03 +0200 Message-Id: <20220714090211.304305-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland By default quirk_mode_page_vendor_specific_apple should be enabled for both scsi-hd and scsi-cd devices to allow MacOS to format SCSI disk devices, and A/UX to enumerate SCSI CDROM devices succesfully without getting stuck in a loop. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-8-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 4745f72c92..b774a5b20a 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -687,8 +687,10 @@ static void q800_init(MachineState *machine) } static GlobalProperty hw_compat_q800[] = { + { "scsi-hd", "quirk_mode_page_vendor_specific_apple", "on"}, { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, + { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on"}, }; static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); From patchwork Thu Jul 14 09:02:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aypKoJ7o; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8674RTkz9sB4 for ; Thu, 14 Jul 2022 19:17:51 +1000 (AEST) Received: from localhost ([::1]:38400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBuyj-0001qh-DZ for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:17:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk4-0005Ar-JN for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk2-000603-Tk for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IBH0BZGGgN90FMU8RzDf0O+2CnQGz444Niu23NFrxjI=; b=aypKoJ7ojJirZqrhNeIMriF5SB9OWhhCQJuS4poa9ZN7dGFscKi8UfC310V+7QqMuSXuQX sVoE3MZ2fQeDR51etJwc2xM7SIwplzAekB19O4g7X0QjVuz79J6ND+Pjs50+6FAFKW7HlL neEeeFmERH5/TWeaTO7/u5wVjOSQZGk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-tJRPuBgVNT6L8LQAv_ag-A-1; Thu, 14 Jul 2022 05:02:37 -0400 X-MC-Unique: tJRPuBgVNT6L8LQAv_ag-A-1 Received: by mail-ed1-f70.google.com with SMTP id h17-20020a056402281100b0043aa5c0493dso1094165ede.16 for ; Thu, 14 Jul 2022 02:02:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IBH0BZGGgN90FMU8RzDf0O+2CnQGz444Niu23NFrxjI=; b=T6IeaaqR7vroS9lBSReLJH0uLlrG5Jg765Ep+LdaTxYiV5TqdfHiz/A5r7OiZ83qDj RXZjlaMSm76D8vKF+evqThDZKPifIcJM3Zru8O3mSk7b8lm+g70NeVLPSvGzkbiqqH/G DRH9CFefq5UFmhfvua4JGVvjInJ+mpkR4LsC18rpYGOFYgVdRe6KWk2Jz4uXeL7ssphO Zq76YEJwNMjr/SUvKObE4bijAu9xribzUvhof1RtZyio0cCwIk3iFrG6cq80qugzFBMh DkODKajn/a8YMCeNm9IkwbsvDXvaOmMyjYG1ZduSlhhMRlPwbWmRqWJJEA1iPukVGuaL Nw9A== X-Gm-Message-State: AJIora8y+hitS7lV3nrsfRWG1PYR/t/pdTDaMJumcJmWYC5bh6cWyWJL NKnqePzUtMG4WcmdJOM7yqLhMSROBdCGlDKIvjecGO7dLGFZQ8IeKRQ12Jv+3qbANyNNLLah4nt BbfksUkp2H0RGMaLcMv9LU2bkGNHH5L7TDB77ol1f4Dr/lBm078UYgq8jgInkQd2bgbw= X-Received: by 2002:a05:6402:1e8f:b0:43a:ddfc:5c4e with SMTP id f15-20020a0564021e8f00b0043addfc5c4emr11004582edf.358.1657789355702; Thu, 14 Jul 2022 02:02:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sgSNv1sw8JRCuJANulOn8HVqgEoez3/orV9CoYniIta7i7eZyz4IRDM8muVAyRDGip6KVz0w== X-Received: by 2002:a05:6402:1e8f:b0:43a:ddfc:5c4e with SMTP id f15-20020a0564021e8f00b0043addfc5c4emr11004553edf.358.1657789355451; Thu, 14 Jul 2022 02:02:35 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id j4-20020aa7c0c4000000b0043a3b90748asm677549edp.26.2022.07.14.02.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 13/20] scsi-disk: add FORMAT UNIT command Date: Thu, 14 Jul 2022 11:02:04 +0200 Message-Id: <20220714090211.304305-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland When initialising a drive ready to install MacOS, Apple HD SC Setup first attempts to format the drive. Add a simple FORMAT UNIT command which simply returns success to allow the format to succeed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220622105314.802852-9-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 4 ++++ hw/scsi/trace-events | 1 + 2 files changed, 5 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 2cdbba7ccc..9413b33bac 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2180,6 +2180,9 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf) trace_scsi_disk_emulate_command_WRITE_SAME( req->cmd.buf[0] == WRITE_SAME_10 ? 10 : 16, r->req.cmd.xfer); break; + case FORMAT_UNIT: + trace_scsi_disk_emulate_command_FORMAT_UNIT(r->req.cmd.xfer); + break; default: trace_scsi_disk_emulate_command_UNKNOWN(buf[0], scsi_command_name(buf[0])); @@ -2585,6 +2588,7 @@ static const SCSIReqOps *const scsi_disk_reqops_dispatch[256] = { [VERIFY_10] = &scsi_disk_emulate_reqops, [VERIFY_12] = &scsi_disk_emulate_reqops, [VERIFY_16] = &scsi_disk_emulate_reqops, + [FORMAT_UNIT] = &scsi_disk_emulate_reqops, [READ_6] = &scsi_disk_dma_reqops, [READ_10] = &scsi_disk_dma_reqops, diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 20fb0dc162..03b2640934 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -334,6 +334,7 @@ scsi_disk_emulate_command_UNMAP(size_t xfer) "Unmap (len %zd)" scsi_disk_emulate_command_VERIFY(int bytchk) "Verify (bytchk %d)" scsi_disk_emulate_command_WRITE_SAME(int cmd, size_t xfer) "WRITE SAME %d (len %zd)" scsi_disk_emulate_command_UNKNOWN(int cmd, const char *name) "Unknown SCSI command (0x%2.2x=%s)" +scsi_disk_emulate_command_FORMAT_UNIT(size_t xfer) "Format Unit (len %zu)" scsi_disk_dma_command_READ(uint64_t lba, uint32_t len) "Read (sector %" PRId64 ", count %u)" scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write %s(sector %" PRId64 ", count %u)" scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Command: lun=%d tag=0x%x data=%s" From patchwork Thu Jul 14 09:02:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UjI2Do/p; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8HS6XH1z9sB4 for ; Thu, 14 Jul 2022 19:25:56 +1000 (AEST) Received: from localhost ([::1]:56360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv6X-000641-LM for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:25:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk6-0005BU-6G for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk4-00060V-Er for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ITcwNs94bqpAb2bGyOg0ZV+GYhMASrM2rJCPaUnfMr4=; b=UjI2Do/poCqkxCaDYFHuku1oy/6a+XgKkDr7vQVCoJ+AvBrRx/obpQ73fzO1U1WFjj7nVl 29n57GpOMqeA9IQqORJ38wnQgDfmgoJWLwb9ndUm6lKS16pn8aVzFamfnvK29jCJiQOSRs foALtVKpL7dKKPKounHkIISmVwn3qHs= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-pfT4ogswNlyKCqR4y7NX7Q-1; Thu, 14 Jul 2022 05:02:38 -0400 X-MC-Unique: pfT4ogswNlyKCqR4y7NX7Q-1 Received: by mail-ed1-f72.google.com with SMTP id c9-20020a05640227c900b0043ad14b1fa0so1119848ede.1 for ; Thu, 14 Jul 2022 02:02:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ITcwNs94bqpAb2bGyOg0ZV+GYhMASrM2rJCPaUnfMr4=; b=HliExn+qsxtkCPv1Y7ZNvXWuqmSqb1QWDG/mOqd0HcV+igQT1m99ujsMfDxxihRelD VM60j+sDBIRtieh9PLRdzx0lR9s94/BgGHl1mZNcsw+T6Gq/uebmscX695KXlHYa7vgw 6KkPEO9QelUT3N9VuGAYd71nWXjeVzyjGXUYwHI5BlyrHiKuUeq8bdf9mlMLwFXz+i3+ S8jEOstzosG33HcuM43E+HPVoleW4rNyN8s9DLiwHyyv/kZ5aVKnP1x76vQXymsv/eXB cI2W88Vkf8tRug9dG0Vm2iKg9kgv4FVNiMTDffu460AxgDXEKyiakA6zvSdTBBFrNnKN PdDg== X-Gm-Message-State: AJIora94w6GtptveFrJPJbaesK9m3qxuRHBz/m3cWp9PoQzxRu7zE7XN /pMLlpJtNjdyJTVhAFYZXGIjUrTDq1rt0/WGtm4rXpSVzR0q8jlyxo84+Q4PxKqGKLmyY0AJv9q 7hSGxRxCch03pIA1Vuq/6eN30MqSHRZr5r0eMrcBumrZQzh60N+6wVB/8ZsmyYnizI+0= X-Received: by 2002:a17:906:49d5:b0:717:7d2f:d6ed with SMTP id w21-20020a17090649d500b007177d2fd6edmr7713423ejv.750.1657789357239; Thu, 14 Jul 2022 02:02:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYP7nHq+5ow94T2vjBu69qWjkJAFY9ZU+0WhxNg5DUdFTp2ZPt4JZe/eSkf6nR+eWIjbZkRg== X-Received: by 2002:a17:906:49d5:b0:717:7d2f:d6ed with SMTP id w21-20020a17090649d500b007177d2fd6edmr7713404ejv.750.1657789356894; Thu, 14 Jul 2022 02:02:36 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id l5-20020aa7c3c5000000b0043575ae2051sm679918edr.62.2022.07.14.02.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 14/20] scsi-disk: add SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED quirk for Macintosh Date: Thu, 14 Jul 2022 11:02:05 +0200 Message-Id: <20220714090211.304305-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland When A/UX configures the CDROM device it sends a truncated MODE SELECT request for page 1 (MODE_PAGE_R_W_ERROR) which is only 6 bytes in length rather than 10. This seems to be due to bug in Apple's code which calculates the CDB message length incorrectly. The work at [1] suggests that this truncated request is accepted on real hardware whereas in QEMU it generates an INVALID_PARAM_LEN sense code which causes A/UX to get stuck in a loop retrying the command in an attempt to succeed. Alter the mode page request length check so that truncated requests are allowed if the SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED quirk is enabled, whilst also adding a trace event to enable the condition to be detected. [1] https://68kmla.org/bb/index.php?threads/scsi2sd-project-anyone-interested.29040/page-7#post-316444 Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 7 ++++++- hw/scsi/trace-events | 1 + include/hw/scsi/scsi.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 9413b33bac..2b2e496ebd 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1552,7 +1552,10 @@ static int mode_select_pages(SCSIDiskReq *r, uint8_t *p, int len, bool change) goto invalid_param; } if (page_len > len) { - goto invalid_param_len; + if (!(s->quirks & SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED)) { + goto invalid_param_len; + } + trace_scsi_disk_mode_select_page_truncated(page, page_len, len); } if (!change) { @@ -3151,6 +3154,8 @@ static Property scsi_cd_properties[] = { DEFINE_PROP_BIT("quirk_mode_page_vendor_specific_apple", SCSIDiskState, quirks, SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE, 0), + DEFINE_PROP_BIT("quirk_mode_page_truncated", SCSIDiskState, quirks, + SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 03b2640934..8e927ff62d 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -339,6 +339,7 @@ scsi_disk_dma_command_READ(uint64_t lba, uint32_t len) "Read (sector %" PRId64 " scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write %s(sector %" PRId64 ", count %u)" scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Command: lun=%d tag=0x%x data=%s" scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int len, uint32_t timeout) "disk aio sgio: tag=0x%x cmd=0x%x (sector %" PRId64 ", count %d) timeout=%u" +scsi_disk_mode_select_page_truncated(int page, int len, int page_len) "page %d expected length %d but received length %d" # scsi-generic.c scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc) "Command complete %p tag=0x%x status=%d" diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 011cb84753..e284e3a4ec 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -230,5 +230,6 @@ extern const SCSIReqOps scsi_generic_req_ops; #define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 #define SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD 1 #define SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE 2 +#define SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED 3 #endif From patchwork Thu Jul 14 09:02:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GJOy7PJh; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8MM3bR6z9sB4 for ; Thu, 14 Jul 2022 19:29:19 +1000 (AEST) Received: from localhost ([::1]:34358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv9p-00026M-5q for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:29:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk8-0005DL-D3 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59421) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk6-00060u-Lg for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g7/2rhhJSC5UwuybsQoC8MTZAQnVSiRbNGooBdIOgBk=; b=GJOy7PJhTWel8jPT8WAFsYoWKNdJTVi2b5K8W14ltcHY3a/t1jnqP0qOjSNEW6lnw0z+F9 twC7jgHAG1QbGD16VsEsL6yq0DCBNjN4igZAGL1i3c7JmFsyTPLpYDi5ZSok7o4PrByDBk /fCfQcVZTBIATStsW0+727L4LlVynnQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-501-OmebZRYOP0KF9kuV3trk7g-1; Thu, 14 Jul 2022 05:02:40 -0400 X-MC-Unique: OmebZRYOP0KF9kuV3trk7g-1 Received: by mail-ed1-f72.google.com with SMTP id z5-20020a05640235c500b0043ae18edeeeso1109655edc.5 for ; Thu, 14 Jul 2022 02:02:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g7/2rhhJSC5UwuybsQoC8MTZAQnVSiRbNGooBdIOgBk=; b=Xwgk98vSoZSIJDUNKf1CxGN7heIK69LliKiM0r0rwHir5m3ak5RUqRVKH8P7fxUUwC 27QmmlfD50/xtvssv14xz8XubxcaFzJYIDh12ruIWnLbX6H1TzSBrh1960ppSn6t3ctN vXWt6TWS/sMhPlFScN4z0H1/su1OWmtyTupVS8I8G8WigqfwiBXHflz81XUh10Eqz2kF sHxAzlyT9XkzEBireeYUubJJtgzyCluNKfFtxipdPGfJk7yptccGjiLncsbTyUGLwfXZ Nx7PMzXB75KyIP+k1Wynf45w3tan1ENrYw6o1HkDzgjNi27yjBMXTs1e1UV+vwDelwW4 z8iw== X-Gm-Message-State: AJIora/wctT03fVmX9UtfDxOPRvk9aFJjlBp52f+vqyyh8c3xVv7FEQo mHvndja2kYFoJ007eB+7RJRvKvCfnKbj0qBNuNwXKy89451Hfc89soeCfqs/ayXGGFWB+dRDuum sk2Si5vFubxjwAySNlVC3CVvtyQBWJpWSyvCJaWvTMK+rkTF2VnMVjTnADFnI2NpDwuI= X-Received: by 2002:a17:907:2854:b0:72b:7daf:cc0d with SMTP id el20-20020a170907285400b0072b7dafcc0dmr7645895ejc.524.1657789358787; Thu, 14 Jul 2022 02:02:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1te4mXaqvR6nQd0eHpcSnlDpmpWqwVJ7WkItIqnTQcG7X7Uy2FbjIOPsKO2pdf05jr9/68AZg== X-Received: by 2002:a17:907:2854:b0:72b:7daf:cc0d with SMTP id el20-20020a170907285400b0072b7dafcc0dmr7645870ejc.524.1657789358523; Thu, 14 Jul 2022 02:02:38 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id t6-20020aa7d706000000b0043a85d7d15esm686295edq.12.2022.07.14.02.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 15/20] q800: implement compat_props to enable quirk_mode_page_truncated for scsi-cd devices Date: Thu, 14 Jul 2022 11:02:06 +0200 Message-Id: <20220714090211.304305-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland By default quirk_mode_page_truncated should be enabled for all scsi-cd devices connected to the q800 machine to allow A/UX to enumerate SCSI CDROM devices without hanging. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-11-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index b774a5b20a..3254ffb5c4 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -691,6 +691,7 @@ static GlobalProperty hw_compat_q800[] = { { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on"}, + { "scsi-cd", "quirk_mode_page_truncated", "on"}, }; static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); From patchwork Thu Jul 14 09:02:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LKKNGtqQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk89N3p3Pz9sB4 for ; Thu, 14 Jul 2022 19:20:40 +1000 (AEST) Received: from localhost ([::1]:44198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv1S-0005qt-C0 for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk9-0005Dj-Mi for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk8-00060y-2L for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wr3W8Qgd538GbFfb3zj67MkTs+oRCp+v1IWEC5iv05o=; b=LKKNGtqQpQZaNK7ledD6Mm1ze0Bp0uLvLqD/96q8m9Tl7AnZmwWHGZWPqdVEfS0XmhVAAu OjJ/8UR5Rz1pmlMZ1rtuBN7B675P3FcZ5tEtPSZYJEiaeJ/56sqn0XWxxu2lXHi4bNuUOH MkGphcT4TGGd8FYuuSa8BQmHxpTUOVU= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-KvAYMTCNOTuYEJ-yHMCfgQ-1; Thu, 14 Jul 2022 05:02:41 -0400 X-MC-Unique: KvAYMTCNOTuYEJ-yHMCfgQ-1 Received: by mail-ej1-f70.google.com with SMTP id hq20-20020a1709073f1400b0072b9824f0a2so508436ejc.23 for ; Thu, 14 Jul 2022 02:02:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wr3W8Qgd538GbFfb3zj67MkTs+oRCp+v1IWEC5iv05o=; b=SolNF9seY9FrNL99rnnoPN7vILCV2LQX0xn6PaOQpEWMCkayQgyy1Vm4sZ2w58xKgj KXgiqI02hCPPc5UPz1MeO1GfbWojaCkjhKR/4eS5aRW5p1zqslScHR+A836i1N3IhHDG qhzoWH6nvXkJaIb892zvYOh4hkGgo05Wfr40zvKWHVFOvHC2TimITpGw+QXg7qMBaxiM eVbubv+MPetKEHTArjShOkECEsvKBhY0usglUP6xaMr07hIgeDRXmDseaiWBT7Vwad1Q JPoh93+2KgKrfhLPZpGMqoMP8DlbxsPVrLtDT45ZwSv5mcLabXgyUO8cejMJojuThApm jXag== X-Gm-Message-State: AJIora9e5HkDqaVv9EUqsgedPlvuB8XSw2y+ctNvcxhy4nEMJEeMvwzt RRgYWloOBsq68S+JJCi8CaaWBkVnv+VmMUl4PAnlon9MTkUE5FpfiG5/qw0GkUu9oYBJbOZbdsD 1plTPfVwp6FvX953+nfU+IKU2AKAt4EekYeufeE4X8QQp0bh7jTO7QYhDqzZpQu2NOGs= X-Received: by 2002:a05:6402:5408:b0:435:60fa:5017 with SMTP id ev8-20020a056402540800b0043560fa5017mr10888826edb.223.1657789360363; Thu, 14 Jul 2022 02:02:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vCcElLq5RdJlexRC6NqtbBL94Cmq68EThwj0QIeZpxQg/LJmx3/vM9YahpMcHpqhZsBv2riw== X-Received: by 2002:a05:6402:5408:b0:435:60fa:5017 with SMTP id ev8-20020a056402540800b0043560fa5017mr10888798edb.223.1657789360075; Thu, 14 Jul 2022 02:02:40 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id i8-20020a50fd08000000b0043a554818afsm688489eds.42.2022.07.14.02.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 16/20] scsi-disk: allow the MODE_PAGE_R_W_ERROR AWRE bit to be changeable for CDROM drives Date: Thu, 14 Jul 2022 11:02:07 +0200 Message-Id: <20220714090211.304305-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland A/UX sends a MODE_PAGE_R_W_ERROR command with the AWRE bit set to 0 when enumerating CDROM drives. Since the bit is currently hardcoded to 1 then indicate that the AWRE bit can be changed (even though we don't care about the value) so that the MODE_PAGE_R_W_ERROR page can be set successfully. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-12-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 2b2e496ebd..db27e834da 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1188,6 +1188,10 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, case MODE_PAGE_R_W_ERROR: length = 10; if (page_control == 1) { /* Changeable Values */ + if (s->qdev.type == TYPE_ROM) { + /* Automatic Write Reallocation Enabled */ + p[0] = 0x80; + } break; } p[0] = 0x80; /* Automatic Write Reallocation Enabled */ From patchwork Thu Jul 14 09:02:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aSR/muMA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8Fv1RzGz9sB4 for ; Thu, 14 Jul 2022 19:24:35 +1000 (AEST) Received: from localhost ([::1]:54782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv5E-0004zl-GT for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukB-0005Gl-Vv for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36011) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuk9-00061T-V1 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aPD8blOr1AR3/0Ri08H8H3SESXGTpuldMPhthhSsgzQ=; b=aSR/muMAPOQn3LsK+8lin0txDCC7gcKqCnMk+1QPWAV1p7/KgoAolui76f151AJEyRa9Uv AY1DW1lgJeaE9zpSyDZ+sN7GFGXR2/eQq7LD4R6cK4MGcarAVoPa5hjiPTIbOj5h3ptQR/ mMRk2oJP4UHxO+7GfpdKhlBTSLPK5bk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-TTiWOHV4MCKX31xlzt5Kwg-1; Thu, 14 Jul 2022 05:02:44 -0400 X-MC-Unique: TTiWOHV4MCKX31xlzt5Kwg-1 Received: by mail-ed1-f70.google.com with SMTP id x8-20020a056402414800b0042d8498f50aso1082130eda.23 for ; Thu, 14 Jul 2022 02:02:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aPD8blOr1AR3/0Ri08H8H3SESXGTpuldMPhthhSsgzQ=; b=fe83ND4e+aw2D4LyXWnZdf4S/S9x0tHLUvmzXumafboKCg4S3FSNRrMhYNX/0oEq7q ApchAw6cmzhxr3EZdlXjmAACHK+9VSNHu89nm96VEyl6540Ok/9IJe0o8mHayhCOLBN0 h4BhpsmE6n33p4tW7Lwo5S89g2qph5jf64T36ISaBccIFPEER+Xoslk4/tZa1jNvzEkc u0IdSY9Gskrvkl3WH3moL7haGErVmBz5gcPrJWMq4WCqCplOcwWMmV+v70hniisWap9p DjcdnMqQa9sqq1GNf9UFJLYQfFJHpGR7VU9UN1xbEG0KwhohIzb0XjiB4PvvKBjf/StD nuwQ== X-Gm-Message-State: AJIora9fo5MxAc9ehlYnIGrUeDTY3fxvNKdv+mf4TqgpBHCBZInzi/Lx BZ+zcfQL7jirWd8+XeP+/LJGJB6cBrcTxPsGKD/xNPOUkbJa0+avRVZO/mGi2vPMr2L2xIuCZ3i cA1oRb+rOG0lG5WnTixM6ftw5AYZsT9Vf8TypmL7iVloOTXtH+lVYbSIwXPPX8qV9Gk8= X-Received: by 2002:a17:906:c150:b0:726:b4e7:772 with SMTP id dp16-20020a170906c15000b00726b4e70772mr7516851ejc.499.1657789362428; Thu, 14 Jul 2022 02:02:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sZC6eTWm+qLaCgaIxi/PKWoiqvkcO3rzcLI4L6I880zVM9qv+6Z7o2f3pYn4Bom9qjtNDzbA== X-Received: by 2002:a17:906:c150:b0:726:b4e7:772 with SMTP id dp16-20020a170906c15000b00726b4e70772mr7516827ejc.499.1657789362050; Thu, 14 Jul 2022 02:02:42 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b0072b1cb2818csm456673ejg.158.2022.07.14.02.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 17/20] scsi-disk: allow MODE SELECT block descriptor to set the block size Date: Thu, 14 Jul 2022 11:02:08 +0200 Message-Id: <20220714090211.304305-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland The MODE SELECT command can contain an optional block descriptor that can be used to set the device block size. If the block descriptor is present then update the block size on the SCSI device accordingly. This allows CDROMs to be used with A/UX which requires a CDROM drive which is capable of switching from a 2048 byte sector size to a 512 byte sector size. Signed-off-by: Mark Cave-Ayland Message-Id: <20220622105314.802852-13-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 6 ++++++ hw/scsi/trace-events | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index db27e834da..f5cdb9ad4b 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1616,6 +1616,12 @@ static void scsi_disk_emulate_mode_select(SCSIDiskReq *r, uint8_t *inbuf) goto invalid_param; } + /* Allow changing the block size */ + if (bd_len && p[6] != (s->qdev.blocksize >> 8)) { + s->qdev.blocksize = p[6] << 8; + trace_scsi_disk_mode_select_set_blocksize(s->qdev.blocksize); + } + len -= bd_len; p += bd_len; diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 8e927ff62d..ab238293f0 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -340,6 +340,7 @@ scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write %s(se scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Command: lun=%d tag=0x%x data=%s" scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int len, uint32_t timeout) "disk aio sgio: tag=0x%x cmd=0x%x (sector %" PRId64 ", count %d) timeout=%u" scsi_disk_mode_select_page_truncated(int page, int len, int page_len) "page %d expected length %d but received length %d" +scsi_disk_mode_select_set_blocksize(int blocksize) "set block size to %d" # scsi-generic.c scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc) "Command complete %p tag=0x%x status=%d" From patchwork Thu Jul 14 09:02:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JMmzNJdI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8Tk6KBKz9sB4 for ; Thu, 14 Jul 2022 19:34:49 +1000 (AEST) Received: from localhost ([::1]:40990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBvF8-0006m3-4G for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukD-0005Iv-9J for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukB-00061p-CX for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yPxrUWz/40PCdYS2DePtdFbyH7QmcxCaDkU2H+nwfn0=; b=JMmzNJdIhsvRRild0GaIu+ZMnWwwMMmSYSgI7Wu/DjY3iw/31+SGIARDR9HERZIBehLrHa YVs6jCI2h7UokXGliLUOOBisd889gWf+xFFbgsNmlvPcDisbhUFEcpbg3j4G2vsMV76yBx xcUOLnSGHoftnFeFhCFHNVateAUxSsM= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-279-gaSuume0Mj-VZDoywCCfrg-1; Thu, 14 Jul 2022 05:02:45 -0400 X-MC-Unique: gaSuume0Mj-VZDoywCCfrg-1 Received: by mail-ej1-f72.google.com with SMTP id hp13-20020a1709073e0d00b0072b812bc5e9so507389ejc.9 for ; Thu, 14 Jul 2022 02:02:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yPxrUWz/40PCdYS2DePtdFbyH7QmcxCaDkU2H+nwfn0=; b=MXkekyr61/xhrdsFfcBYFqSfl/+R8S5v/B3RjgiXsKyEPdCIqiMhyTFwXooZJ2f2DC potDS/md0F0gk3HbqqWdMo6W77qrh0qGvHVfpGJIcN0NN1zcEnZt3lV2k0JG4fq2tHBg W6YqWqwikpLMG3cHQBqDHqUbX6UnA9lfjQS6J0V34P6Dg2O9aIcA2biRCM+x32I2Fm/d Tia3vVaoqNbqjlMU0SwQzp1yePki4HSi7X2485A0mLFUooDQr3IEF8hAt0xC8t1jCdqj Ch+Sf+Y7ZPS3rd6xm8ZmzPY1LfiadEZs4NnZkxlHoTmJ5rgvyOuNdUl0bR0y5NLkbsZx voYg== X-Gm-Message-State: AJIora+5s7HCz84HP+kNCZbEi293dhOykONYyXLhPiy5Mdc5zi3cXYkU d0Brk9T8CbK7wk9w0YObuufl0ssilwkUhK7sINgut5xuSde1c2aNZ98O7hpyCeuiHwSFUBgLfvM 02ag4F7KvkKa/RJ40GegGPQasD36r0gPbSA81icwmYqITHq4By0JeLkoXVEhRzmfQhDA= X-Received: by 2002:a50:ce1d:0:b0:43a:742f:9db3 with SMTP id y29-20020a50ce1d000000b0043a742f9db3mr10963969edi.308.1657789363826; Thu, 14 Jul 2022 02:02:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ttbUOMxjHz8BTr52dk9afhjEOyNH45/eUU5l2UbP26u5r2HwPai1gW2L7km2bknzNwH6GWCg== X-Received: by 2002:a50:ce1d:0:b0:43a:742f:9db3 with SMTP id y29-20020a50ce1d000000b0043a742f9db3mr10963949edi.308.1657789363601; Thu, 14 Jul 2022 02:02:43 -0700 (PDT) Received: from goa-sendmail ([93.56.169.184]) by smtp.gmail.com with ESMTPSA id eq22-20020a056402299600b0043a7134b381sm677928edb.11.2022.07.14.02.02.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier Subject: [PULL 18/20] q800: add default vendor and product information for scsi-hd devices Date: Thu, 14 Jul 2022 11:02:09 +0200 Message-Id: <20220714090211.304305-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland The Apple HD SC Setup program uses a SCSI INQUIRY command to check that any SCSI hard disks detected match a whitelist of vendors and products before allowing the "Initialise" button to prepare an empty disk. Add known-good default vendor and product information using the existing compat_prop mechanism so the user doesn't have to use long command lines to set the qdev properties manually. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20220622105314.802852-14-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 3254ffb5c4..dccf192e55 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -688,6 +688,9 @@ static void q800_init(MachineState *machine) static GlobalProperty hw_compat_q800[] = { { "scsi-hd", "quirk_mode_page_vendor_specific_apple", "on"}, + { "scsi-hd", "vendor", " SEAGATE" }, + { "scsi-hd", "product", " ST225N" }, + { "scsi-hd", "ver", "1.0 " }, { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on"}, From patchwork Thu Jul 14 09:02:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=McDqOU8y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk89M4HJvz9sB4 for ; Thu, 14 Jul 2022 19:20:39 +1000 (AEST) Received: from localhost ([::1]:44054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv1Q-0005ku-HX for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:20:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukG-0005MX-0M for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:35418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukD-000626-EQ for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JedoTWOXY7JNxUVgoEPO4DDMHQfmV7WNJPWNZj4qG/4=; b=McDqOU8yNJziwPhxeygHX3r0CE4hG4myZh6fE7Lkp4EeSTYx2+jL8xIVGY+vx9IeJOQfIv 582xHGbqQx0tCOWOIyUg/cL+gzgTgHBxAaTRCOgE6KE7R2dL8ha1UvWlikeEdGsUlUlOPB 0H842k5hageG1YZEkNKBJzYwFkdi040= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-307-K-VKX6hjOKymSJdHWe2HCQ-1; Thu, 14 Jul 2022 05:02:47 -0400 X-MC-Unique: K-VKX6hjOKymSJdHWe2HCQ-1 Received: by mail-ej1-f69.google.com with SMTP id s4-20020a170906500400b006feaccb3a0eso508452ejj.11 for ; Thu, 14 Jul 2022 02:02:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JedoTWOXY7JNxUVgoEPO4DDMHQfmV7WNJPWNZj4qG/4=; b=XJ0TeZa5n6uQiaLpwpJ5JYsXJrZ7Em8fYN7qxnjAene7fWDdVpE90TwHnUnnt92T9m miVFABpWWPyX/WcMMybXBuAhLueMwFP7mxH9CXjo6FwHz/8CKL8dcBsulR402ykktMw3 jSzt3w0h7UR9fStLPHGUVgR3oGeF9sX9+m8K+CT1Z3qpSEdHPb988xZlY5Wy1j5+vOBG 06pzYJFJfsvVkbnDoJT2fjeF2vwZCNCL/mfz1gIasJRKHF47i/r8kV+huueS4n8od+8M Kw+dvazUzcQgPAapUCWruAsZo2hqYug9j+UnfmQV2zgONEuFUApWx3r1FySUrIpwy5/f LyOg== X-Gm-Message-State: AJIora/frjGLblLZ9zZIBzRdIs84AtOrBxNm2WR7vTCzfDdRlFe1XJXj 2fyMCeVyZIe5rxmzcsxdhUnDg7IOD+phA9ikC97HO/uhlvqnVrlXckil/DXC84iZfODxeifDk97 iJDjv1nvW4QXp/gGoRYII/l2+lD27QIukWvvFOpcY3yKIkiDWtfHsaSBpY1aaoGydly0= X-Received: by 2002:a17:906:84f0:b0:72b:5cf4:465d with SMTP id zp16-20020a17090684f000b0072b5cf4465dmr7870962ejb.705.1657789366152; Thu, 14 Jul 2022 02:02:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sFgqYnGx9Vyb13CZn2t+lOEtgWe4Cp/1aOasgVJKLisvKlbfTLCwOGxvzh/h43Ii4jCWDN3Q== X-Received: by 2002:a17:906:84f0:b0:72b:5cf4:465d with SMTP id zp16-20020a17090684f000b0072b5cf4465dmr7870945ejb.705.1657789365872; Thu, 14 Jul 2022 02:02:45 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id kv10-20020a17090778ca00b0072eddc468absm452904ejc.134.2022.07.14.02.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Laurent Vivier Subject: [PULL 19/20] q800: add default vendor and product information for scsi-cd devices Date: Thu, 14 Jul 2022 11:02:10 +0200 Message-Id: <20220714090211.304305-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland The MacOS CDROM driver uses a SCSI INQUIRY command to check that any SCSI CDROMs detected match a whitelist of vendors and products before adding them to the list of available devices. Add known-good default vendor and product information using the existing compat_prop mechanism so the user doesn't have to use long command lines to set the qdev properties manually. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20220622105314.802852-15-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/m68k/q800.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index dccf192e55..101ab0f803 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -695,6 +695,9 @@ static GlobalProperty hw_compat_q800[] = { { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on"}, { "scsi-cd", "quirk_mode_page_truncated", "on"}, + { "scsi-cd", "vendor", "MATSHITA" }, + { "scsi-cd", "product", "CD-ROM CR-8005" }, + { "scsi-cd", "ver", "1.0k" }, }; static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); From patchwork Thu Jul 14 09:02:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1656312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cAyUonPs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lk8L73l9xz9sB4 for ; Thu, 14 Jul 2022 19:28:14 +1000 (AEST) Received: from localhost ([::1]:60986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBv8l-0000rS-Iw for incoming@patchwork.ozlabs.org; Thu, 14 Jul 2022 05:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukK-0005Qj-N9 for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBukF-00062N-Dh for qemu-devel@nongnu.org; Thu, 14 Jul 2022 05:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657789370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MtsR/tM7k67a4bE2GsvxVx53jg+bM1PYQJk4fjczQuA=; b=cAyUonPskaXbumjAYhGuML6lqJhgl2SFvqkUg+DmeFQZmz4lWYXqRqDTt0gOvqZ/1rE2Cw xc9JM3WC6nJ7uXg7+95ccODWaNvnO/JBDMmvDHLLNgqeQoIq/UDn0cZfF11I/nWKi4pqcH gQ3rYnLhe8TWN/SZptqMy2dCb0g+Fwg= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-uWStmG0wMD2soZHh-e8ISQ-1; Thu, 14 Jul 2022 05:02:49 -0400 X-MC-Unique: uWStmG0wMD2soZHh-e8ISQ-1 Received: by mail-ed1-f69.google.com with SMTP id v19-20020a056402349300b0043b0f690cbaso1102319edc.11 for ; Thu, 14 Jul 2022 02:02:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MtsR/tM7k67a4bE2GsvxVx53jg+bM1PYQJk4fjczQuA=; b=LG2b732PbxeTIprEDXZpA7EP5YOBh/77JtZHuI6fBMijcz0jT1tlvzGLQ8/dUSE/Lm VPmwIusUuM6cNytZS1G9z4HsdZAN8qxsCNlPhqHQizuv4VzcUFvkcuO4YC6GIQroTMRN TBp7c1IHjFbmXGjyi/EsF9MsE7cTER5yVGmV43U+ppfJ2OY4bI2YmJRlHLF5NdrvfMOL w8rQXh1CFYoU2GmIfZqGP3puZj6bnNfn/Tuh++IGKKK1nfgHZjNhMT8RB2HLfdjPTOVL FXZbdKsYkDIlAzq6aC7J0F/Op7AJyM69ISACXAICdEiD22Ej5rbyeKxBHQPO2sStlU94 5Cww== X-Gm-Message-State: AJIora+GQwQaafGttbNta5HW3RYzwxLxdj5Y4hW4iwIE6z9VahMZJiBi WEn6hqvhaPDlLFET2DvhOON5k5UF2e2WjTSr7CKbjkgrucN1U1TnwyneuguwFdqCoo0uIjKZeZx lc9CbvW7yMwg0bnjv/dOX2WcaFHoFTwmSB6MmFY0WVM+wM6FIa/yB32TnHMr6Cx6dJlQ= X-Received: by 2002:a17:907:6e13:b0:72b:509e:bd6b with SMTP id sd19-20020a1709076e1300b0072b509ebd6bmr7828987ejc.202.1657789367853; Thu, 14 Jul 2022 02:02:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1ovsObNJD5PFYsrI5l4Oq0feVgFC7el0HTWE/ZD4KyerGOf5YiwXP5cu5qfhjvxhpCwTu7g== X-Received: by 2002:a17:907:6e13:b0:72b:509e:bd6b with SMTP id sd19-20020a1709076e1300b0072b509ebd6bmr7828969ejc.202.1657789367571; Thu, 14 Jul 2022 02:02:47 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id i20-20020aa7c9d4000000b004358f6e0570sm685734edt.17.2022.07.14.02.02.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 02:02:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/20] pc-bios/s390-ccw: add -Wno-array-bounds Date: Thu, 14 Jul 2022 11:02:11 +0200 Message-Id: <20220714090211.304305-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220714090211.304305-1-pbonzini@redhat.com> References: <20220714090211.304305-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The option generates a lot of warnings for integers casted to pointers, for example: /home/pbonzini/work/upstream/qemu/pc-bios/s390-ccw/dasd-ipl.c:174:19: warning: array subscript 0 is outside array bounds of ‘CcwSeekData[0]’ [-Warray-bounds] 174 | seekData->cyl = 0x00; | ~~~~~~~~~~~~~~^~~~~~ Signed-off-by: Paolo Bonzini --- pc-bios/s390-ccw/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 26ad40f94e..c8784c2a08 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -35,6 +35,7 @@ EXTRA_CFLAGS += $(call cc-option,-Werror $(EXTRA_CFLAGS),-Wno-stringop-overflow) EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS), -fno-stack-protector) +EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS), -Wno-array-bounds) EXTRA_CFLAGS += -msoft-float EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS),-march=z900,-march=z10) EXTRA_CFLAGS += -std=gnu99