From patchwork Mon Sep 28 13:19:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=O3EVSfB8; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0NhS4lFkz9sSC for ; Mon, 28 Sep 2020 23:31:20 +1000 (AEST) Received: from localhost ([::1]:53094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtFO-0004bs-Il for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:31:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4J-0000eU-N4 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:19:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4E-0002n4-DY for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:19:50 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299185; 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=hl9slfH0zxQ134l7Pfr//jBOIgk547l+qxt5CXwb7Qs=; b=O3EVSfB84UVLxgT23LlsnN+DiqrhTpHgI7gzknF9HICuW7WnwghitD5OyGMc2Jh2bJy+S+ T3vlxNedLxznctnFO2Up+sEE61awueC3SQYADo0cEbZnOfzQHHmvY/7aLlQSMhAQ3CJYwT +G9b4FPgD7HeUq8htvZKG1Y0S+3ihvg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-330-OZvyuggeMXG0QGFHLIRHLA-1; Mon, 28 Sep 2020 09:19:44 -0400 X-MC-Unique: OZvyuggeMXG0QGFHLIRHLA-1 Received: by mail-wm1-f69.google.com with SMTP id u5so379146wme.3 for ; Mon, 28 Sep 2020 06:19:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hl9slfH0zxQ134l7Pfr//jBOIgk547l+qxt5CXwb7Qs=; b=qG47DXk6NYEQRBAyX4NW9UsbKUZlrhX2mAS9SqHZc7VaF8SfXSZkkXw25KLzRxejwo b7g19TCtHeP6H/qbmD4AGkBsK/1mDaKE27me29/eiA+799B3tM1lMW4Unz0iQvUn2hoe EFvOv3gVkT52YUU6QHulsSlkrarCrTPGbiZNb/0SbBlm62WlxYjKh3pGbiNhr7DK+dyn CzkN6lTmUOPMosNAxJ0HKWPhsNdhwhqfjwmyQYJYMjLdioTzAoOAZ2YK2CjJYZi+Ymnq Q/MzAqxhLlo+dQQU3Zdp2ch9Syli5l8PvptRuIPxuzTGfDDgDzcndQ93EI9xD7Me7Jbu nEgA== X-Gm-Message-State: AOAM530WYL1U0KSNFbydJMdEuAd8IorbtEjg+3FZAeXU3ElaUIXokq/v 7Dl7osKH65piv1KZtuKHPOkPOxempCV0+JpOFJV1VTzQRDc7O2HOGSQa3YDagsUZqTf4c6Snthg OJVT2dxgytPyckQo= X-Received: by 2002:a1c:55c3:: with SMTP id j186mr1633390wmb.77.1601299182704; Mon, 28 Sep 2020 06:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYoCu1W8ZOZC50kwm5Zi6PF3g8Wmc0+2rWOCbNTMdTYqqf1+PiCnHb4SkFJYiiU4evQRThQg== X-Received: by 2002:a1c:55c3:: with SMTP id j186mr1633363wmb.77.1601299182508; Mon, 28 Sep 2020 06:19:42 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id b64sm1344104wmh.13.2020.09.28.06.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:19:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/8] qemu/bswap: Remove unused qemu_bswap_len() Date: Mon, 28 Sep 2020 15:19:27 +0200 Message-Id: <20200928131934.739451-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:47:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Kamil Rytarowski , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Last use of qemu_bswap_len() has been removed in commit e5fd1eb05ec ("apb: add busA qdev property to PBM PCI bridge"). Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/bswap.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 1d3e4c24e41..8b01c38040c 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -169,12 +169,6 @@ CPU_CONVERT(le, 16, uint16_t) CPU_CONVERT(le, 32, uint32_t) CPU_CONVERT(le, 64, uint64_t) -/* len must be one of 1, 2, 4 */ -static inline uint32_t qemu_bswap_len(uint32_t value, int len) -{ - return bswap32(value) >> (32 - 8 * len); -} - /* * Same as cpu_to_le{16,32}, except that gcc will figure the result is * a compile-time constant if you pass in a constant. So this can be From patchwork Mon Sep 28 13:19:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=d2m/geH+; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0P3t0rFxz9s1t for ; Mon, 28 Sep 2020 23:48:10 +1000 (AEST) Received: from localhost ([::1]:33398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtVg-0004R9-0M for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:48:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4X-0000jT-5l for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4Q-0002nc-97 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:04 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299193; 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=05siY0cHdlWfeeA7J6d3xMUvet3cGKDwDV5A5FHlLno=; b=d2m/geH+d6BFOXXE47N7uJB5hLeWm6P2BWoF2V2Y0zlWtYXW5V++wb4/xBodrJn9POOPqe bwFvyNme5+usoP+aHjHork7vsOccHmPgkVp4UkPTBqGnzGAg7yMTtvbYrj6/zA41jANZPJ LDn8JvNE2ewuI0C+2imvwt/+IgW0W58= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-XinFjvMtOFK8Xbbi1n9JJA-1; Mon, 28 Sep 2020 09:19:49 -0400 X-MC-Unique: XinFjvMtOFK8Xbbi1n9JJA-1 Received: by mail-wm1-f72.google.com with SMTP id y18so343994wma.4 for ; Mon, 28 Sep 2020 06:19:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=05siY0cHdlWfeeA7J6d3xMUvet3cGKDwDV5A5FHlLno=; b=ReUBIZo8nDLVOewzkXyMSG+swRmat2tEn6iJ5rlh2oYpuhdBK/SIfI3zLOyI9p4DSK Xe+QaOs8yDBKrmTSa8QKTdwE8HrG1OHwtLNRYl88uV/dUZUPKYyXiw8LFf8ezKfJ1VKt pSPq/ftaBmtXWp/7dMAyMTDxWMh6NJwvombNHLpDLizKokkCH1IFBI+Fn3GFi0SJEghK e8BfdeJFWRNEMiZk/zLdhYj7vJ0+dQWnaFgAChivHt3vmbm5izVqAeTYF0w16uvEGe5c TS+ogCBFBQC8Jgz4g6Abv+SlyZWDT7L94kmbMvEa1BFomzF7f1j5bgK9KxS5DApfI/zh sciQ== X-Gm-Message-State: AOAM530+ma1/tGwBWlmVH2EeC9SgDtyIlrwkJPpLF7GqB/brZ59A27v7 kV052p6TDYZDGuu42thGCRuPhk9myiO1jtWRVW2RER36StGPEJ8W1SJ+5AS8+l/fPMIaHYgkyqU mdedIleyrlDFlu8U= X-Received: by 2002:adf:edcc:: with SMTP id v12mr1674399wro.240.1601299187948; Mon, 28 Sep 2020 06:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKLPNwa34IqYdT5WX6CUVduVT7I5vLBBYwH0Iuh4tpURZlygsaB19A+gi4Tj394WDtQd/fyw== X-Received: by 2002:adf:edcc:: with SMTP id v12mr1674369wro.240.1601299187747; Mon, 28 Sep 2020 06:19:47 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id i26sm1370291wmb.17.2020.09.28.06.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:19:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/8] qemu/bswap: Replace bswapXX() by compiler __builtin_bswap() Date: Mon, 28 Sep 2020 15:19:28 +0200 Message-Id: <20200928131934.739451-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:29:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Kamil Rytarowski , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use the compiler built-in function to byte swap values, as the compiler is clever and will fold constants. Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/bswap.h | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 8b01c38040c..41131d3d76e 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -27,32 +27,13 @@ static inline uint64_t bswap64(uint64_t x) { return bswap_64(x); } -# else -static inline uint16_t bswap16(uint16_t x) -{ - return (((x & 0x00ff) << 8) | - ((x & 0xff00) >> 8)); -} - -static inline uint32_t bswap32(uint32_t x) -{ - return (((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24)); -} - -static inline uint64_t bswap64(uint64_t x) -{ - return (((x & 0x00000000000000ffULL) << 56) | - ((x & 0x000000000000ff00ULL) << 40) | - ((x & 0x0000000000ff0000ULL) << 24) | - ((x & 0x00000000ff000000ULL) << 8) | - ((x & 0x000000ff00000000ULL) >> 8) | - ((x & 0x0000ff0000000000ULL) >> 24) | - ((x & 0x00ff000000000000ULL) >> 40) | - ((x & 0xff00000000000000ULL) >> 56)); -} +#else +#undef bswap16 +#define bswap16(_x) __builtin_bswap16(_x) +#undef bswap32 +#define bswap32(_x) __builtin_bswap32(_x) +#undef bswap64 +#define bswap64(_x) __builtin_bswap64(_x) #endif /* ! CONFIG_MACHINE_BSWAP_H */ static inline void bswap16s(uint16_t *s) From patchwork Mon Sep 28 13:19:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=NymI8jyU; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0PF3413Qz9s1t for ; Mon, 28 Sep 2020 23:56:07 +1000 (AEST) Received: from localhost ([::1]:54252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtdN-000517-Hn for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:56:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4W-0000ho-Hj for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4Q-0002no-92 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:01 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299196; 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=/GuNNoh6nkdsrmjKbQNZ/H8CBCcsX4tPVisO++gKbE0=; b=NymI8jyUMD9t3Z4oqWb/HWUJfPuJwtj3X6PJPKu5YAG3DUC+YVxuAAVblxZSs8A1sTd5vN EVOpDL2pORJZCiwUd2Z0Mnd5JmDZsBdLH2oFFqNOzRMKfKTyCUcVg9cSTbWkjNVkwQqRVQ DiaayKuKZbqQgVZUt75Uc8c9rWHAEGM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-MlqOGRoeMzyeJCfi71QOng-1; Mon, 28 Sep 2020 09:19:54 -0400 X-MC-Unique: MlqOGRoeMzyeJCfi71QOng-1 Received: by mail-wr1-f72.google.com with SMTP id d13so389425wrr.23 for ; Mon, 28 Sep 2020 06:19:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/GuNNoh6nkdsrmjKbQNZ/H8CBCcsX4tPVisO++gKbE0=; b=qo7tW22pxSVOH81OETb74e6ySEyiU4XuRAZ+PLtwAlwiHXVUA5JtvG/Rw4RlwJjJ+Y HsUUv+UxxvVFcaJHx6SB/z9+647obDOqbib+RTIv2SkH/d8qfBVL1sHtI1lVRQ0T7QC+ MJ+SOW+8KeUkZdg9S5/NyZ3ueaa78dwixswmZQOZhjJ+H/P2QKj6WZF+DE4gtsQ+SLZN vpNTPRMW38fXVFd1ZNgWiewejhRdTUgYJBK4kD0IIQA4XyMVmEhjHEucq3iPMlkhxOy7 VAzvCengpC5NYM9rr4oYJ0jNewySMHqR0SSeBR/4cagNaRnKLGGTkPuHN2psniEh7yl7 A1Zg== X-Gm-Message-State: AOAM5330MnRkwhwnZ4Yv++WFHRk6j5e5vPcy41xfGuyJGdVi0+Xpg0wn 3mKYCDNRYFOnZoRm2j0u5IwcipOEp+I6rIopT08oxz6hM4I4IBZ4SCdJvxbMDC+cmHsiktPyqeP jCKpixW8yyqacAi4= X-Received: by 2002:a7b:c84a:: with SMTP id c10mr1597334wml.139.1601299193214; Mon, 28 Sep 2020 06:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyat1laQPxulibnFjOJctKDEtgKO4pKfyi/4oZgnhBrfdQVkb9kh6nVGm0ZFsSjsDUCiOH5sw== X-Received: by 2002:a7b:c84a:: with SMTP id c10mr1597319wml.139.1601299193024; Mon, 28 Sep 2020 06:19:53 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id z83sm1392284wmb.4.2020.09.28.06.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:19:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/8] qemu/bswap: Replace bswapXXs() by compiler __builtin_bswap() Date: Mon, 28 Sep 2020 15:19:29 +0200 Message-Id: <20200928131934.739451-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:29:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Kamil Rytarowski , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/bswap.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 41131d3d76e..fed96dddd7a 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -38,29 +38,31 @@ static inline uint64_t bswap64(uint64_t x) static inline void bswap16s(uint16_t *s) { - *s = bswap16(*s); + *s = __builtin_bswap16(*s); } static inline void bswap32s(uint32_t *s) { - *s = bswap32(*s); + *s = __builtin_bswap32(*s); } static inline void bswap64s(uint64_t *s) { - *s = bswap64(*s); + *s = __builtin_bswap64(*s); } #if defined(HOST_WORDS_BIGENDIAN) #define be_bswap(v, size) (v) -#define le_bswap(v, size) glue(bswap, size)(v) +#define le_bswap(v, size) glue(__builtin_bswap, size)(v) #define be_bswaps(v, size) -#define le_bswaps(p, size) do { *p = glue(bswap, size)(*p); } while(0) +#define le_bswaps(p, size) \ + do { *p = glue(__builtin_bswap, size)(*p); } while (0) #else #define le_bswap(v, size) (v) -#define be_bswap(v, size) glue(bswap, size)(v) +#define be_bswap(v, size) glue(__builtin_bswap, size)(v) #define le_bswaps(v, size) -#define be_bswaps(p, size) do { *p = glue(bswap, size)(*p); } while(0) +#define be_bswaps(p, size) \ + do { *p = glue(__builtin_bswap, size)(*p); } while (0) #endif /** From patchwork Mon Sep 28 13:19:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=bV9QYbnW; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0Np65mRtz9s1t for ; Mon, 28 Sep 2020 23:36:14 +1000 (AEST) Received: from localhost ([::1]:33534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtK7-0008M1-VZ for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:36:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4Y-0000ja-4b for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4W-0002oP-D8 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:05 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299201; 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=IQxJXzhc1czKuYkocMWwWEQUckk+RWA2innt4R1BD+0=; b=bV9QYbnWdfIbSI8+lKsblDtkZLOlSivKSwr8FqaeO3CxvFohfWHjyZuPZRxm21N8r6wrhg iABrQRWRiAnirlQvKEUOj+v8JHalPNxk3D1CRPXNvwl3SNHTRiLCCzhMrm1cQ1an9KaM+S Xe11iB79UHwyzQZTZwMd0MEJ3X5QQrI= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-x2rfnPbvM6KLpdrrQQ9ETw-1; Mon, 28 Sep 2020 09:19:59 -0400 X-MC-Unique: x2rfnPbvM6KLpdrrQQ9ETw-1 Received: by mail-wr1-f72.google.com with SMTP id 33so400922wrk.12 for ; Mon, 28 Sep 2020 06:19:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IQxJXzhc1czKuYkocMWwWEQUckk+RWA2innt4R1BD+0=; b=ASPS2V9u/6LNDlZ/bt92/j9jeORrcwQ2H+0cHveZjPuSWjdhXQV9I4Fl2LBMz1AsvP xNcmZig5/aHBP+Y/LD/RaOyWsFtfq8h7cujr/aGWQ3Ur5A1ipuiA8pHBDolS5LWEWZfs mliAKWhd/zNuR/BNBXg5f09it3CSJgNf0ZPV1BcJaFyYHc5xqwrUFtCgZj/DfluxX/Ec Gh283sOugC2hY+yxYou1gsaviq3mzLiTez5Ug4+fDTyeKPOy8cH5kcSWsvYMC+f7tQ52 spQYqk7kh8kAJQTBPswJreV5AW9FDM8dW7cr8m8+HwQDY568YbCV6mU5zxJGoINzt/xb 3hfA== X-Gm-Message-State: AOAM530tVzTKkcbM4262j/S6NNJgzaQOFMnc9K47grpV6eVAQzI29J7K /K9hl9OJ5K42YWF4TfMvkz1q/ig/lpNcx/L+a1DAosb+Ssegoh4QfEQybTg3KzqQC3ifUw+PKT8 oHHMuag1SO9LKp7M= X-Received: by 2002:a5d:522d:: with SMTP id i13mr1818020wra.296.1601299198479; Mon, 28 Sep 2020 06:19:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzblxRHV4qk9P2hlAVjSPw3Wp0Nhe/xUUzTvRLnKirvlK6osBca2K+2+wIrV8HZYIs84O6bSA== X-Received: by 2002:a5d:522d:: with SMTP id i13mr1818005wra.296.1601299198312; Mon, 28 Sep 2020 06:19:58 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id k6sm1201517wmi.1.2020.09.28.06.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:19:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/8] qemu/bswap: Remove dependency Date: Mon, 28 Sep 2020 15:19:30 +0200 Message-Id: <20200928131934.739451-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:47:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Kamil Rytarowski , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which supports __builtin_bswap(). Drop the dependency. Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- configure | 13 ------------- include/qemu/bswap.h | 17 ----------------- 2 files changed, 30 deletions(-) diff --git a/configure b/configure index e8e8e984f24..bff787daea7 100755 --- a/configure +++ b/configure @@ -4886,16 +4886,6 @@ if test "$docs" != "no" ; then fi fi -# Search for bswap_32 function -byteswap_h=no -cat > $TMPC << EOF -#include -int main(void) { return bswap_32(0); } -EOF -if compile_prog "" "" ; then - byteswap_h=yes -fi - # Search for bswap32 function bswap_h=no cat > $TMPC << EOF @@ -6789,9 +6779,6 @@ fi if test "$st_atim" = "yes" ; then echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak fi -if test "$byteswap_h" = "yes" ; then - echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak -fi if test "$bswap_h" = "yes" ; then echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak fi diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index fed96dddd7a..55916670d39 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -10,23 +10,6 @@ # include #elif defined(__HAIKU__) # include -#elif defined(CONFIG_BYTESWAP_H) -# include - -static inline uint16_t bswap16(uint16_t x) -{ - return bswap_16(x); -} - -static inline uint32_t bswap32(uint32_t x) -{ - return bswap_32(x); -} - -static inline uint64_t bswap64(uint64_t x) -{ - return bswap_64(x); -} #else #undef bswap16 #define bswap16(_x) __builtin_bswap16(_x) From patchwork Mon Sep 28 13:19:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=H8B7to1p; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0P6s4ncYz9sSs for ; Mon, 28 Sep 2020 23:50:45 +1000 (AEST) Received: from localhost ([::1]:39748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtYB-0007Cy-Et for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:50:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4b-0000pn-Hg for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4Z-0002op-O6 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:09 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299207; 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=01GR7uo5lwZc+yIqp2XAePCo6kJWui/s9AmyV2I4Bcc=; b=H8B7to1pV23otGZrYFCKFydib2+dmHxLnAGRRIwbxAAPD7TmB8oD5zE2teuOnf4dEf6F9i und8CDRRKGr8h4HfjxkD2EUgrVIDTfUZQmRDrRm+smEmZZnBzWDjKnYDWIiFFm30ZTj/6a 6hPBTpc+17gwxUv5ToojqXgq6fd3iDw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-ffp61MN1PQSjuAUMF991Tw-1; Mon, 28 Sep 2020 09:20:05 -0400 X-MC-Unique: ffp61MN1PQSjuAUMF991Tw-1 Received: by mail-wr1-f72.google.com with SMTP id 33so401061wrk.12 for ; Mon, 28 Sep 2020 06:20:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=01GR7uo5lwZc+yIqp2XAePCo6kJWui/s9AmyV2I4Bcc=; b=GGu6LLVEzyxOIXeuIsoatk9fH0MdxM9E7JR53C6GztBhGVXJ+LO8LGBXzv1s609f0w RACVDfuCUVakF2nUXv2pkjc/mATsBJuXcHCv0qWmC/T5tanUAnceP+088invt4cjmj5Y RItRtHqYpeeJEvLpQ5qQ1IvNoKuHsQXfYWJS4LeGEBB9TJdcSzDxSX4sbEoqNuDBWedO NlrVYGYn8e3SOj4X1BR5tpLkMbh6E5UhQ2FeaYA84avyCzp9cuw4VPXlCyocmthQE3qa nnLd/sH3d2SYvP88vv4ZwvmtwpYb6w0fkRdPqy5u8ZQqcCSnZuP3a1y2J9g+jOpr/Kf8 8sxA== X-Gm-Message-State: AOAM532RENMNue7NMts8i0s13bx+6YORPktGFCNqqJS++LLRvZYZWRFf FaiVLpPN4G80KgkRqitVA3c10S0WzAOYgjCO8F3BISJGZsoUzRCLR+eI2A4yAGCoZhNL3jMM+L3 jOg0ctpFncxAP/xc= X-Received: by 2002:adf:9b8b:: with SMTP id d11mr1816014wrc.71.1601299203798; Mon, 28 Sep 2020 06:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRb/MptPfIb8V1ZZQJzsk6PCTgiXyYbDVQOS/vQAmwn1XFKrLmnjBlEJjT0jPXMMKaVlCz+Q== X-Received: by 2002:adf:9b8b:: with SMTP id d11mr1815982wrc.71.1601299203649; Mon, 28 Sep 2020 06:20:03 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id f12sm1132893wmf.26.2020.09.28.06.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:20:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/8] qemu/bswap: Use compiler __builtin_bswap() on Haiku Date: Mon, 28 Sep 2020 15:19:31 +0200 Message-Id: <20200928131934.739451-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:29:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , David Carlier , Carlo Arenas , Kamil Rytarowski , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which supports __builtin_bswap(). Remove the Haiku specific ifdef'ry. This reverts commit 652a46ebba970017c7a23767dcc983265cdb8eb7 ("bswap.h: Include on Haiku for bswap operations"). Signed-off-by: Philippe Mathieu-Daudé --- Cc: David Carlier Cc: Carlo Arenas --- include/qemu/bswap.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 55916670d39..719d620bfe6 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -8,8 +8,6 @@ # include #elif defined(__FreeBSD__) # include -#elif defined(__HAIKU__) -# include #else #undef bswap16 #define bswap16(_x) __builtin_bswap16(_x) From patchwork Mon Sep 28 13:19:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=HQsnbO8I; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0NsW5MZYz9s1t for ; Mon, 28 Sep 2020 23:39:11 +1000 (AEST) Received: from localhost ([::1]:42082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtMz-0003ff-I9 for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:39:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4h-00012f-Hd for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4f-0002pF-LH for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:15 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299212; 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=se/oNrbj72j7l4wWWeNKso7ox10vwm+7m/MBRp2oEp4=; b=HQsnbO8IFM8xrEoDxlHpgNls8BwwmmlG3Q8665znSaVdYLcQcyovj+eb3vMsbwebcpcuTc FvJ79iMFCmpAH63QEzev0wPhkfz3lehOO2ZOgE5uKSYiz4qytG1sriDrzjzvqicz3acV12 zCBoyRSnE8xcJ1Su5WWmIYyvrwMlUco= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-9SD2m5LTPjyo4ulc7pE1-A-1; Mon, 28 Sep 2020 09:20:10 -0400 X-MC-Unique: 9SD2m5LTPjyo4ulc7pE1-A-1 Received: by mail-wr1-f70.google.com with SMTP id 33so401171wrk.12 for ; Mon, 28 Sep 2020 06:20:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=se/oNrbj72j7l4wWWeNKso7ox10vwm+7m/MBRp2oEp4=; b=ok0dPgmpdCw7WpwfO7McDbJEr9FYNNg6/TSPtCTe5U8GlrmpoEStgcmNGeAvIcK7Y6 zx+Xetjk1HWgKY6h5z03r7i4DJlrPY7hyBVstb+p4js5siHAlGIVfgOF/zt25NlgBSap s35kYIykMSH6I+6VRpII0isvKKVzTGGRMRvEMu4nbm8IQ+gzsdfjti9mZLvxTs1KfpL7 7yme3HzO9WiPvumUcDyxl8RjxRWOuGtATSfdFIiaHv0oqJmUD9JcuFoKjI3dPn2Y4jHm IGzO+BE613O7yRWWhbfgRq3Q80gRdLqAGOKqpW6vc+TJ/eKgj71CjzHu29Z0z0h3OX0W OCEg== X-Gm-Message-State: AOAM531gwAfm3NjIWEmhpYEztEzt3kNAde/YOFs7oCZXHRbGPcAyNnGy HguBzg5yMuljX/tmhNyd2TpOYD9qRg4WNUbXzu3Eg1B2uAGoeQ+fS7UKc75B+fL+xYh13V7XVwU t5/QMnlCysKsYres= X-Received: by 2002:adf:a29a:: with SMTP id s26mr1698400wra.197.1601299209069; Mon, 28 Sep 2020 06:20:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUE02FaPHU84DL31UVZTdkSiT6Kw4FelT6seiFl635D8xxNJTA2H9fSmXydnxs+8HeE17oUA== X-Received: by 2002:adf:a29a:: with SMTP id s26mr1698382wra.197.1601299208893; Mon, 28 Sep 2020 06:20:08 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id y68sm1281318wmd.39.2020.09.28.06.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:20:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 6/8] qemu/bswap: Use compiler __builtin_bswap() on FreeBSD Date: Mon, 28 Sep 2020 15:19:32 +0200 Message-Id: <20200928131934.739451-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:47:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Kamil Rytarowski , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which supports __builtin_bswap(). Remove the FreeBSD specific ifdef'ry. This reverts commit de03c3164accc21311c39327601fcdd95da301f3 ("bswap: Fix build on FreeBSD 10.0"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ed Maste --- Cc: Ed Maste --- include/qemu/bswap.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 719d620bfe6..1a297bfec22 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -6,8 +6,6 @@ #ifdef CONFIG_MACHINE_BSWAP_H # include # include -#elif defined(__FreeBSD__) -# include #else #undef bswap16 #define bswap16(_x) __builtin_bswap16(_x) From patchwork Mon Sep 28 13:19:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=X3njXVqW; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0Njc2MZ2z9s1t for ; Mon, 28 Sep 2020 23:32:20 +1000 (AEST) Received: from localhost ([::1]:54212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtGM-00058t-5e for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:32:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt4m-0001Dv-I0 for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt4k-0002sS-Ib for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:20 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299217; 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=sA8HBLAd+5/ZjYUElQKsQkBPTjMwphQifvUOAKUKqLY=; b=X3njXVqW+YAzRQNbw7neZT1PCtov0jXkTQS0+Z+rm9PLbf8QhbKkXQ/dqMwL8auKP7Z6XD FrTbGPeSGWEmg5MHcXjR5YqmlmU2HQbHELz27qum7zdYBsEIlivyw1uAQok7WF52rCBSr8 WMp9ivMJikjGr/jDbHuvwehZowodNxI= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-msNteCO4Mbuv_Fp9Gf2CRw-1; Mon, 28 Sep 2020 09:20:16 -0400 X-MC-Unique: msNteCO4Mbuv_Fp9Gf2CRw-1 Received: by mail-wr1-f70.google.com with SMTP id d13so389920wrr.23 for ; Mon, 28 Sep 2020 06:20:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sA8HBLAd+5/ZjYUElQKsQkBPTjMwphQifvUOAKUKqLY=; b=jxKVnkhzuH7BunHiRSlqskpowxUVRoE67O9x789K8RHvve8lGkUcDj3+pJnmhYVlhx PDhh3wngBXkV2JxVy1V5k9Jacs5+mfxGwBNm9VA00YSv7QLERCYdjr3DzW7O2cs9ob2w 2ZK7VcBXLigNKOwKOVPuOepKVrMHBE2iIjvSVDAfbDqe62BVO4AF9bvB/xayYGCoJAif xxO56N1fdEOZTcyJ+d80czhKPD3MEL6qej8NFhZTNRYVnpiyTdftwMy1QZfLIgT595Li EwV3F8x6XA9fp7ZYyEidBd7CTtOkkvTC9FZ8rLRHJKDsZmqgoexrdAoc0uItJac6n1ai t+9g== X-Gm-Message-State: AOAM530xOoqDEsojXw9chvZjpNTNIqpnj+zTxeQn7zyXp9YqvfqhJRDX bv0riTWlgdE8PIeONFi3nf05LBsPT2977Ty31XkBMus5yg0wUa5DcqJWvaxj0R2N+SMmnHSyV9x ABeZ8E20jA1pnLOw= X-Received: by 2002:a1c:bdd4:: with SMTP id n203mr1583644wmf.119.1601299214473; Mon, 28 Sep 2020 06:20:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEekBAVGlab3ArbOg3zRXJpzuwxev55ZyX+AzjMJADRVtos1SnupBe8YxhFGjJqQ5N1hG0Pw== X-Received: by 2002:a1c:bdd4:: with SMTP id n203mr1583620wmf.119.1601299214237; Mon, 28 Sep 2020 06:20:14 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id n66sm1263253wmb.35.2020.09.28.06.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:20:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 7/8] qemu/bswap: Use compiler __builtin_bswap() on NetBSD Date: Mon, 28 Sep 2020 15:19:33 +0200 Message-Id: <20200928131934.739451-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:47:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, 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_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= , Kamil Rytarowski , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which supports __builtin_bswap(). Remove the NetBSD specific ifdef'ry. This reverts commit 1360677cfe3ca8f945fa1de77823df21a77e4500 ("makes NetBSD use the native bswap functions"). Signed-off-by: Philippe Mathieu-Daudé --- configure | 15 --------------- include/qemu/bswap.h | 5 ----- 2 files changed, 20 deletions(-) diff --git a/configure b/configure index bff787daea7..1b0a02a0af8 100755 --- a/configure +++ b/configure @@ -4886,18 +4886,6 @@ if test "$docs" != "no" ; then fi fi -# Search for bswap32 function -bswap_h=no -cat > $TMPC << EOF -#include -#include -#include -int main(void) { return bswap32(0); } -EOF -if compile_prog "" "" ; then - bswap_h=yes -fi - ########################################## # Do we have libiscsi >= 1.9.0 if test "$libiscsi" != "no" ; then @@ -6779,9 +6767,6 @@ fi if test "$st_atim" = "yes" ; then echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak fi -if test "$bswap_h" = "yes" ; then - echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak -fi if test "$curl" = "yes" ; then echo "CONFIG_CURL=y" >> $config_host_mak echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 1a297bfec22..7e586531c09 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -3,17 +3,12 @@ #include "fpu/softfloat-types.h" -#ifdef CONFIG_MACHINE_BSWAP_H -# include -# include -#else #undef bswap16 #define bswap16(_x) __builtin_bswap16(_x) #undef bswap32 #define bswap32(_x) __builtin_bswap32(_x) #undef bswap64 #define bswap64(_x) __builtin_bswap64(_x) -#endif /* ! CONFIG_MACHINE_BSWAP_H */ static inline void bswap16s(uint16_t *s) { From patchwork Mon Sep 28 13:19:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1372652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=S8dEPtdi; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4C0NxN4fmlz9s1t for ; Mon, 28 Sep 2020 23:42:32 +1000 (AEST) Received: from localhost ([::1]:50490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMtQE-0007VX-Jx for incoming@patchwork.ozlabs.org; Mon, 28 Sep 2020 09:42:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMt5C-0001ox-1I for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kMt57-0002yX-5n for qemu-devel@nongnu.org; Mon, 28 Sep 2020 09:20:45 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601299240; 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=fm6WWS9bLJ1+765QuleIRGTm1J4tvn4WsZZ1hKdwNQQ=; b=S8dEPtdiMbwQCVXhf4aqa/uXtGi1k7ofxxntMi1jbopdZz8hBrgVrQiISjVtRsIXap9flm WGC7VQxdQdSG0jMe6X0CFy2iysg62TZ9vK2pTRhuIG2Gj9ujdWrCchGmzvfTby4nApp5l6 uO8LEs4WFA+18qVro1XU9tr9r/TGBlA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-ZZc9k6iIPVWSF3V1jm7vTQ-1; Mon, 28 Sep 2020 09:20:21 -0400 X-MC-Unique: ZZc9k6iIPVWSF3V1jm7vTQ-1 Received: by mail-wr1-f71.google.com with SMTP id r16so394840wrm.18 for ; Mon, 28 Sep 2020 06:20:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fm6WWS9bLJ1+765QuleIRGTm1J4tvn4WsZZ1hKdwNQQ=; b=O+JJFHxJk0far5MILTZJ701euBFuIrNl3nP68qGvkP3JoGh6if8OWAvg28xijUNI8c aTNWr3fY8tNcXljTYYLgC1H6cQ2/cow2rtUTZS7JZQTH8et3g0TUZedKZWhj0OV4xQBy +kCZqHhJ6/gNCTAV1RYW2jdtGD26NRs/tf1os0UIZgo4RHbhZviA7vV7ziu+tER88a2P io4FY6fPRQt53MdmSsqGfXzdgRMrQ5Wv53rG9DmtqROrqm6BXQXwr96VVS/3tBJlHB+1 0DtEY6gU4z3H5SIMZ8QCz4mPEfgOeRnfnNhYjX+HX0RdPLEDSVd3eSInvWD7zdnDsXGY IFfg== X-Gm-Message-State: AOAM530xP/3rurlaDfpYzf7PZspoVQvHS1OLe6fWQmvnzC4wJ7UIMpxY 6piSzkR56pH8g4oat419v+M33+D3rvw0cU6ip1jyLjb1/5bgRXPYhSsV7E7xu94KbXW7P4CgQQs NTqTHrYGacTqisaE= X-Received: by 2002:a5d:67c2:: with SMTP id n2mr1672828wrw.4.1601299219840; Mon, 28 Sep 2020 06:20:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKv9zlQi+ODNCvNFXjHA8Bicbujft1+bzvCzkTsX8grgu8kzSBFw87MPA9S8AEmjjRFpA1jA== X-Received: by 2002:a5d:67c2:: with SMTP id n2mr1672804wrw.4.1601299219549; Mon, 28 Sep 2020 06:20:19 -0700 (PDT) Received: from localhost.localdomain (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id p3sm1120145wmm.40.2020.09.28.06.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 06:20:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 8/8] tests/vm: Add Haiku test based on their vagrant images Date: Mon, 28 Sep 2020 15:19:34 +0200 Message-Id: <20200928131934.739451-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200928131934.739451-1-philmd@redhat.com> References: <20200928131934.739451-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/28 03:47:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_BTC_ID=0.499, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Alexander von Gluck IV , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Kamil Rytarowski , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Alexander von Gluck IV Signed-off-by: Alexander von Gluck IV [PMD: Avoid to recreate the image each time] Signed-off-by: Philippe Mathieu-Daudé --- RFC because Alexander will probably add more comments to this patch. tests/keys/vagrant | 27 +++++++++ tests/keys/vagrant.pub | 1 + tests/vm/Makefile.include | 3 +- tests/vm/basevm.py | 5 +- tests/vm/haiku.x86_64 | 116 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 tests/keys/vagrant create mode 100644 tests/keys/vagrant.pub create mode 100755 tests/vm/haiku.x86_64 diff --git a/tests/keys/vagrant b/tests/keys/vagrant new file mode 100644 index 00000000000..7d6a083909e --- /dev/null +++ b/tests/keys/vagrant @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI +w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP +kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2 +hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO +Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW +yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd +ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1 +Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf +TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK +iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A +sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf +4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP +cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk +EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN +CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX +3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG +YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj +3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+ +dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz +6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC +P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF +llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ +kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH ++vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ +NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s= +-----END RSA PRIVATE KEY----- diff --git a/tests/keys/vagrant.pub b/tests/keys/vagrant.pub new file mode 100644 index 00000000000..b8d012d787f --- /dev/null +++ b/tests/keys/vagrant.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== well-known vagrant key for qemu-test, do not use on any machine exposed to an external network diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 61f893ffdc0..e94d95ec541 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -4,7 +4,7 @@ EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd) -IMAGES := freebsd netbsd openbsd centos fedora +IMAGES := freebsd netbsd openbsd centos fedora haiku.x86_64 ifneq ($(GENISOIMAGE),) IMAGES += ubuntu.i386 centos ifneq ($(EFI_AARCH64),) @@ -41,6 +41,7 @@ endif else @echo " (install genisoimage to build centos/ubuntu images)" endif + @echo " vm-build-haiku.x86_64 - Build QEMU in Haiku VM" @echo "" @echo " vm-build-all - Build QEMU in all VMs" @echo " vm-clean-all - Clean up VM images" diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 3fac20e929a..00f1d5ca8da 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -44,6 +44,7 @@ 'machine' : 'pc', 'guest_user' : "qemu", 'guest_pass' : "qemupass", + 'root_user' : "root", 'root_pass' : "qemupass", 'ssh_key_file' : SSH_KEY_FILE, 'ssh_pub_key_file': SSH_PUB_KEY_FILE, @@ -245,13 +246,13 @@ def ssh(self, *cmd): return self._ssh_do(self._config["guest_user"], cmd, False) def ssh_root(self, *cmd): - return self._ssh_do("root", cmd, False) + return self._ssh_do(self._config["root_user"], cmd, False) def ssh_check(self, *cmd): self._ssh_do(self._config["guest_user"], cmd, True) def ssh_root_check(self, *cmd): - self._ssh_do("root", cmd, True) + self._ssh_do(self._config["root_user"], cmd, True) def build_image(self, img): raise NotImplementedError diff --git a/tests/vm/haiku.x86_64 b/tests/vm/haiku.x86_64 new file mode 100755 index 00000000000..634ef774870 --- /dev/null +++ b/tests/vm/haiku.x86_64 @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +# +# Haiku VM image +# +# Copyright 2020 Haiku, Inc. +# +# Authors: +# Alexander von Gluck IV +# +# This code is licensed under the GPL version 2 or later. See +# the COPYING file in the top-level directory. +# + +import os +import re +import sys +import time +import socket +import subprocess +import basevm + +VAGRANT_KEY_FILE = os.path.join(os.path.dirname(__file__), + "..", "keys", "vagrant") + +VAGRANT_PUB_KEY_FILE = os.path.join(os.path.dirname(__file__), + "..", "keys", "vagrant.pub") + +HAIKU_CONFIG = { + 'cpu' : "max", + 'machine' : 'pc', + 'guest_user' : "vagrant", + 'guest_pass' : "", + 'root_user' : "vagrant", + 'root_pass' : "", + 'ssh_key_file' : VAGRANT_KEY_FILE, + 'ssh_pub_key_file': VAGRANT_PUB_KEY_FILE, + 'memory' : "4G", + 'extra_args' : [], + 'qemu_args' : "-device VGA", + 'dns' : "", + 'ssh_port' : 0, + 'install_cmds' : "", + 'boot_dev_type' : "block", + 'ssh_timeout' : 1, +} + +class HaikuVM(basevm.BaseVM): + name = "haiku" + arch = "x86_64" + + link = "https://app.vagrantup.com/haiku-os/boxes/r1beta2-x86_64/versions/20200702/providers/libvirt.box" + csum = "41c38b316e0cbdbc66b5dbaf3612b866700a4f35807cb1eb266a5bf83e9e68d5" + + poweroff = "shutdown" + + requirements = [ + "devel:libbz2", + "devel:libcapstone", + "devel:libcurl", + "devel:libfdt", + "devel:libgcrypt", + "devel:libgl", + "devel:libglib_2.0", + "devel:libgnutls", + "devel:libgpg_error", + "devel:libintl", + "devel:libjpeg", + "devel:liblzo2", + "devel:libncursesw", + "devel:libnettle", + "devel:libpixman_1", + "devel:libpng16", + "devel:libsdl2_2.0", + "devel:libsnappy", + "devel:libssh2", + "devel:libtasn1", + "devel:libusb_1.0", + "devel:libz", + "setuptools_python3" + ] + + # https://dev.haiku-os.org/ticket/16512 virtio disk1 shows up as 0 (reversed order) + BUILD_SCRIPT = """ + set -e; + rm -rf /tmp/qemu-test.* + cd $(mktemp -d /tmp/qemu-test.XXXXXX); + mkdir src build; cd src; + tar -xf /dev/disk/virtual/virtio_block/0/raw; + cd ../build + ../src/configure --python=python3 {configure_opts}; + make --output-sync -j{jobs} {target} {verbose}; + """ + + def build_image(self, img): + self.print_step("Downloading disk image") + tarball = self._download_with_cache(self.link, sha256sum=self.csum) + + self.print_step("Extracting disk image") + + subprocess.check_call(["tar", "xzf", tarball, "./box.img", "-O"], + stdout=open(img, 'wb')) + + self.print_step("Preparing disk image") + self.boot(img) + + # Wait for ssh to be available. + self.wait_ssh(wait_root=True, cmd="exit 0") + + # Install packages + self.ssh_root("pkgman install -y %s" % " ".join(self.requirements)) + self.graceful_shutdown() + + self.print_step("All done") + +if __name__ == "__main__": + sys.exit(basevm.main(HaikuVM, config=HAIKU_CONFIG))