Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4432329imw; Tue, 19 Jul 2022 06:34:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tEARJCSA0Vj67tIzt3D+WytSE59Q7+/88BMwdOcU6JHTrSDINAREngzyQ0qH6j/bzhSZy7 X-Received: by 2002:a17:907:2bf1:b0:72b:5cc3:79cf with SMTP id gv49-20020a1709072bf100b0072b5cc379cfmr6328816ejc.382.1658237651834; Tue, 19 Jul 2022 06:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658237651; cv=none; d=google.com; s=arc-20160816; b=tP3ZfsKnJq4WHyFxKf9jkXPJApg5LkVEu4skEt9OHWZ38L4qm1zLb7hnf5dMm1yRgJ EKhFUwBnJ1Q6USJOVZ9hIQHmhWc/1YkfPco6Au4IJKod5R7on2dh4TMAOaFqUTf58yRQ hUegztO/sU05WuO3QIDDRrXH8iT/qaAAiZOZABcTmz4oIuM+4lKKoSVDzJwdxPqic/1y mid1ScgRExdMb25mndAqHjwGuRc73H0jXRv7IzA4RROcP5wv3RMhJzRV29wlJhKe3NgU ZiuttvdDRnKNvdhYAy8+7h28GjZlrNfMDkc3Fn3seN5OVQNb6ASulXIEvsxkYr4cZnuc uNLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mj4pW+fOEi0/lhc2qihjk67W/G6SmVdEWfD+mLXONok=; b=ulX9uyLn88cPtLh63wcRsm7qqdUjvJ0IFp5o/YdNPwOhNixiqv+d+kl3gsTObKNlPH VzNTMpVckbThdv4XxCDOABFN9RkMoJKP1LhwWWwgUtLmE+m0YJT4Fif6/LW//BjqPJUF hHeNEZzNn/GGGSyaeURuDuGucBNUowOtFXP+fSUdxIz3pwZIdDeXYtWDR5IfksY4AO99 xW3vd/xd5GiQ5Ed+phEwNv+Mr92HHQ+FcEOk7PaI33C1YXHk04UI9a6jwc5ZYHknGjhg wlOM+scTKLI0QhHK56j2j25DXqaESvoulrnbk1E4NQ5x1ijiU/lum84oJE7IVFgXfVBL nwBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k1q7PSjh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056402278700b004356df8591csi19967225ede.373.2022.07.19.06.33.46; Tue, 19 Jul 2022 06:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k1q7PSjh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237198AbiGSMZp (ORCPT + 99 others); Tue, 19 Jul 2022 08:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239979AbiGSMY1 (ORCPT ); Tue, 19 Jul 2022 08:24:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DE249B7B; Tue, 19 Jul 2022 05:09: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2AC126175D; Tue, 19 Jul 2022 12:08:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19DA4C341C6; Tue, 19 Jul 2022 12:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232499; bh=mC7wYh07JK50tJslQVx5F4oC6FD+eTXlRQ0ZX62rplc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1q7PSjhxJE6v7SbQ/KE0M8GGMbVSU2MZNgCgMgUEoGdjrSpHkfyaR2gqQTxo63ot HLjnefoNmQ/PU+JketEWMiIqiRoSs3jaFD6frr6+lCVTVdFHPnlQGtDA00kTF6gCtn PYu19w1Jb70sb6xEo2Ergp3x+ERLDNBF3nvaIQAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.10 078/112] virtio_mmio: Restore guest page size on resume Date: Tue, 19 Jul 2022 13:54:11 +0200 Message-Id: <20220719114634.058925206@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 7dec1418bf7c..e8ef0c66e558 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