From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D27DFCCA47F for ; Wed, 6 Jul 2022 15:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234116AbiGFPda (ORCPT ); Wed, 6 Jul 2022 11:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234138AbiGFPch (ORCPT ); Wed, 6 Jul 2022 11:32:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E527A29802; Wed, 6 Jul 2022 08:32:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 988EDB81ADA; Wed, 6 Jul 2022 15:32:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D7FC341CB; Wed, 6 Jul 2022 15:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657121534; bh=aArpVS4VNheVFDiOhTep3qwKK7+LFJJviBSs/dkrB5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zj61nxLdI5J32pUTuW7OYjTE8WJ+uOxHmXfLyW+7XO3dwCFhmU1+Ls/r4I33RWFCK NuDfSaJ2PBy1JCukTrr6GAtFjNsgA7ldkSQpH3mgOSZfkVb1QGpsP/9e+5ruseFyJO IvoEWFqzFwGzqqgVEhRz9RAQFnTb5XUQM6KUCjNNbQ1l6Fs9OJpFBmdX1YUCBIf6MZ 3xYZRjKia12CY7M+BpdppILx6SvfuTjnlb4MhwEfHQzBlurVDVp31S30vsfkM0KntU kuQHt1zyjjoSmvxAo/nr40Dv0dE1T6ZL9OR7N3u3C0gfwKPcv7dIBaN9/OM6lWKkwo 7tvyEh1Tfw9Yg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephan Gerhold , "Michael S . Tsirkin" , Sasha Levin , jasowang@redhat.com, virtualization@lists.linux-foundation.org Subject: [PATCH AUTOSEL 5.15 06/18] virtio_mmio: Restore guest page size on resume Date: Wed, 6 Jul 2022 11:31:41 -0400 Message-Id: <20220706153153.1598076-6-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220706153153.1598076-1-sashal@kernel.org> References: <20220706153153.1598076-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stephan Gerhold [ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/virtio/virtio_mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 7522832529dd..fe696aafaed8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) { struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); + if (vm_dev->version == 1) + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + return virtio_device_restore(&vm_dev->vdev); } -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1DE1C43334 for ; Wed, 6 Jul 2022 15:32:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5077C4186C; Wed, 6 Jul 2022 15:32:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5077C4186C Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Zj61nxLd X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NCeTZsBxDm9n; Wed, 6 Jul 2022 15:32:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 81B0F41781; Wed, 6 Jul 2022 15:32:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 81B0F41781 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 566E3C0035; Wed, 6 Jul 2022 15:32:19 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44386C0077 for ; Wed, 6 Jul 2022 15:32:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 13ECF81252 for ; Wed, 6 Jul 2022 15:32:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 13ECF81252 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Zj61nxLd X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gRVYUncqWSi6 for ; Wed, 6 Jul 2022 15:32:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4615380F50 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4615380F50 for ; Wed, 6 Jul 2022 15:32:16 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A5110B81D9B; Wed, 6 Jul 2022 15:32:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D7FC341CB; Wed, 6 Jul 2022 15:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657121534; bh=aArpVS4VNheVFDiOhTep3qwKK7+LFJJviBSs/dkrB5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zj61nxLdI5J32pUTuW7OYjTE8WJ+uOxHmXfLyW+7XO3dwCFhmU1+Ls/r4I33RWFCK NuDfSaJ2PBy1JCukTrr6GAtFjNsgA7ldkSQpH3mgOSZfkVb1QGpsP/9e+5ruseFyJO IvoEWFqzFwGzqqgVEhRz9RAQFnTb5XUQM6KUCjNNbQ1l6Fs9OJpFBmdX1YUCBIf6MZ 3xYZRjKia12CY7M+BpdppILx6SvfuTjnlb4MhwEfHQzBlurVDVp31S30vsfkM0KntU kuQHt1zyjjoSmvxAo/nr40Dv0dE1T6ZL9OR7N3u3C0gfwKPcv7dIBaN9/OM6lWKkwo 7tvyEh1Tfw9Yg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 06/18] virtio_mmio: Restore guest page size on resume Date: Wed, 6 Jul 2022 11:31:41 -0400 Message-Id: <20220706153153.1598076-6-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220706153153.1598076-1-sashal@kernel.org> References: <20220706153153.1598076-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Cc: Sasha Levin , virtualization@lists.linux-foundation.org, Stephan Gerhold , "Michael S . Tsirkin" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" From: Stephan Gerhold [ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/virtio/virtio_mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 7522832529dd..fe696aafaed8 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -556,6 +556,9 @@ static int virtio_mmio_restore(struct device *dev) { struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); + if (vm_dev->version == 1) + writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + return virtio_device_restore(&vm_dev->vdev); } -- 2.35.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization