From patchwork Tue Aug 8 14:59:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 1818642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.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=IIopsSQs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RKxFV28lQz1yYl for ; Wed, 9 Aug 2023 01:00:29 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTOBD-0002gz-OK; Tue, 08 Aug 2023 10:59:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTOBC-0002gQ-9N for qemu-devel@nongnu.org; Tue, 08 Aug 2023 10:59:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTOBA-0003tX-0D for qemu-devel@nongnu.org; Tue, 08 Aug 2023 10:59:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691506761; 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; bh=BaWdBayN+/XneRZ2rEWopSDSYzwiHS0GVLVdSuCFCH8=; b=IIopsSQs82xIBSOjQ0wTo/cIcXL08q6U7r3UxcivKGOFxX6l6szOCmlM0oO1GPEpzoEsol HtjqwAEzSOxMc+e0sFoo5S5Vvri94DEDDQZXv1R0vLd0+tFW29y5x2C/NloguyjvoGCQuO EgQEuPGquUdML1kUiS8f3+wVGVsg5+g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-26-qDs4D1V-PMWNSXa-v5GpBw-1; Tue, 08 Aug 2023 10:59:19 -0400 X-MC-Unique: qDs4D1V-PMWNSXa-v5GpBw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C0B5800C78 for ; Tue, 8 Aug 2023 14:59:19 +0000 (UTC) Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E9E492C13; Tue, 8 Aug 2023 14:59:18 +0000 (UTC) From: Laszlo Ersek To: lersek@redhat.com, qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= Subject: [PATCH] vfio/pci: hide ROM BAR on SFC9220 10/40G Ethernet Controller PF Date: Tue, 8 Aug 2023 16:59:16 +0200 Message-Id: <20230808145916.81657-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass client-ip=170.10.133.124; envelope-from=lersek@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The Solarflare Communications SFC9220 NIC's physical function (PF) appears to expose an expansion ROM with the following characteristics: (1) Single-image ROM, with only a legacy BIOS image (no UEFI driver). Alex's rom-parser utility dumps it like this: > Valid ROM signature found @0h, PCIR offset 20h > PCIR: type 0 (x86 PC-AT), vendor: 1924, device: 0a03, class: 000002 > PCIR: revision 3, vendor revision: 1 > Last image (2) The BIOS image crashes when booted on i440fx. (3) The BIOS image prints the following messages on q35: > Solarflare Boot Manager (v5.2.2.1006) > Solarflare Communications 2008-2019 > gPXE (http://etherboot.org) - [...] PCI[...] PnP PMM[...] So it appears like a modified derivative of old gPXE. Alex surmised in advance that the BIOS image could be accessing host-physical addresses rather than guest-phys ones, leading to the crash on i440fx. Don't expose the option ROM BAR to the VM by default. While this prevents netbooting the VM off the PF on q35/SeaBIOS (a relatively rare scenario), it does not make any difference for UEFI, and at least the VM doesn't crash during boot on i440fx/SeaBIOS (a relatively frequent scenario). Users can restore the original behavior via the QEMU cmdline and the libvirt domain XML. (In two years, we've not seen any customer interest in this bug, hence there's no incentive to investigate (2).) Cc: Alex Williamson (supporter:VFIO) Cc: "Cédric Le Goater" (supporter:VFIO) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1975776 Signed-off-by: Laszlo Ersek --- hw/vfio/pci-quirks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index f4ff83680572..270eb16b91fa 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -45,6 +45,10 @@ static const struct { uint32_t device; } rom_denylist[] = { { 0x14e4, 0x168e }, /* Broadcom BCM 57810 */ + { 0x1924, 0x0a03 }, /* Solarflare Communications + * SFC9220 10/40G Ethernet Controller + * https://bugzilla.redhat.com/show_bug.cgi?id=1975776 + */ }; bool vfio_opt_rom_in_denylist(VFIOPCIDevice *vdev)