From patchwork Tue Apr 5 15:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 1613495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Pg3SAQB1; 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 4KXsFX25dHz9s07 for ; Wed, 6 Apr 2022 01:36:48 +1000 (AEST) Received: from localhost ([::1]:50302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nblEc-0005kC-AO for incoming@patchwork.ozlabs.org; Tue, 05 Apr 2022 11:36:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nblBd-0008U5-Pl for qemu-devel@nongnu.org; Tue, 05 Apr 2022 11:33:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nblBc-0003yG-4z for qemu-devel@nongnu.org; Tue, 05 Apr 2022 11:33:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649172819; 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=5Uq7DE7cZO1deQaJbvM3lIszCBeQOVFN9M1aTfL+W9A=; b=Pg3SAQB1DAkXbHlkE0g61Up4UJ2jcGVuDbP3yitX/K63Crw6s3GSZqpcqcBP+AUkLXJcOG G0yxAQ59wLSrL7bNtP5zT5ShdW4euB1rQ64fC0xwpNJU9+Q3YuqPHmGtmUgR0bNnKo40Db NPYhooOxiE50+4Pak7DLLAuKD8lQuFI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-pMY1iZ7DNeSNFSfRf9hC6A-1; Tue, 05 Apr 2022 11:33:35 -0400 X-MC-Unique: pMY1iZ7DNeSNFSfRf9hC6A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 168223C11A16; Tue, 5 Apr 2022 15:33:35 +0000 (UTC) Received: from localhost (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE6521415131; Tue, 5 Apr 2022 15:33:34 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [RFC v2 6/8] stubs: add memory_region_from_host() and memory_region_get_fd() Date: Tue, 5 Apr 2022 16:33:21 +0100 Message-Id: <20220405153323.2082242-7-stefanha@redhat.com> In-Reply-To: <20220405153323.2082242-1-stefanha@redhat.com> References: <20220405153323.2082242-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , Thomas Huth , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, "Michael S. Tsirkin" , Laurent Vivier , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alberto Faria , Markus Armbruster , Yanan Wang , Eduardo Habkost , Hanna Reitz , Stefan Hajnoczi , Paolo Bonzini , John Snow , sgarzare@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The blkio block driver will need to look up the file descriptor for a given pointer. This is possible in softmmu builds where the memory API is available for querying guest RAM. Add stubs so tools like qemu-img that link the block layer still build successfully. In this case there is no guest RAM but that is fine. Bounce buffers and their file descriptors will be allocated with libblkio's blkio_alloc_mem_region() so we won't rely on QEMU's memory_region_get_fd() in that case. Signed-off-by: Stefan Hajnoczi --- stubs/memory.c | 13 +++++++++++++ stubs/meson.build | 1 + 2 files changed, 14 insertions(+) create mode 100644 stubs/memory.c diff --git a/stubs/memory.c b/stubs/memory.c new file mode 100644 index 0000000000..e9ec4e384b --- /dev/null +++ b/stubs/memory.c @@ -0,0 +1,13 @@ +#include "qemu/osdep.h" +#include "exec/memory.h" + +MemoryRegion *memory_region_from_host(void *host, ram_addr_t *offset) +{ + return NULL; +} + +int memory_region_get_fd(MemoryRegion *mr) +{ + return -1; +} + diff --git a/stubs/meson.build b/stubs/meson.build index 6f80fec761..1e274d2db2 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -25,6 +25,7 @@ stub_ss.add(files('is-daemonized.c')) if libaio.found() stub_ss.add(files('linux-aio.c')) endif +stub_ss.add(files('memory.c')) stub_ss.add(files('migr-blocker.c')) stub_ss.add(files('module-opts.c')) stub_ss.add(files('monitor.c'))