Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2501444pxb; Sun, 16 Jan 2022 22:56:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4mauGJu0b8YvpKh+Txd/Gfi94GNcE9sCyveJyLEnMplkAVpetwAtPMs9glpikIuvqy9KE X-Received: by 2002:a63:81c3:: with SMTP id t186mr3013230pgd.127.1642402560462; Sun, 16 Jan 2022 22:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642402560; cv=none; d=google.com; s=arc-20160816; b=YJwQAAS28EPfPkhuFxqv8RRQy8l7L6p9gbYn3S1S+rHXc+wrOpnElHwqbMHOhW/ftF 5w2kPL6laYdcvtknvpQo47o39fi0J72Hse6U3HaijPpr0DkxGjUM40gye2IjIzDG/wrV ++vVU9omkJkSkNSQfcxpX/zA5i5OL3Ua+CR73HmXx2xtJ3s1KJWzxVw/hKJfC2KmvkS4 cmfUiO284fBKEWNODDh5+4IeXRK6kbWAUlpviu1FVX4GXI9Y1FAni/wAQlFnsFevIUTb JF0z7CRNN3y1N0ttfJ34aWsUCm9EkUsCT3NMiknWwpFId2L37eB07cLaahlDTrZhVL5N ofYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=aUSbpjYloyV7P6r8ifds+Oz50/fmqtt7D+Cv8m+7K7A=; b=JIIo9tigmPar1VEnnxLN/c/e5x/HDqXkMAnSuLS6GafS62+vqVSyF7xv7H+JDyp0XK /+89OaqMRZREtWDnyEe5BNwMBgfHZpJEubO1F3stfNP7c/ApL+ogA1wFuMmnmbmEOF2J lmY/mVU3opFQT8MLX63YDuRsW/DaRT3S5LINC1m3a5nEvGVpfhW+nLgv6Cj8YbevgrCg XbwRiElV43OpGY1aW5OAmygAUdV6xEbhqSx/vZepMMT484yhYOWulQvxJza4qfkBaXr7 3rKG76qcCwQ4wbD9YeGQdNebOrGpbSD1aoJQTX0etEmyultVCIQvFNT9JBLVZxvW2ZSd GMOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e22si11516243pgn.653.2022.01.16.22.55.48; Sun, 16 Jan 2022 22:56:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234989AbiAPLyl (ORCPT + 99 others); Sun, 16 Jan 2022 06:54:41 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:52965 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232933AbiAPLyk (ORCPT ); Sun, 16 Jan 2022 06:54:40 -0500 Received: from [192.168.100.1] ([82.142.13.186]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.119]) with ESMTPSA (Nemesis) id 1MF45G-1n6vRv3Iro-00FQij; Sun, 16 Jan 2022 12:54:07 +0100 Message-ID: <77e747de-c7d6-314d-e0b0-58852d463326@vivier.eu> Date: Sun, 16 Jan 2022 12:54:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v8 3/4] clocksource/drivers: Add a goldfish-timer clocksource Content-Language: fr To: Arnd Bergmann Cc: Linux Kernel Mailing List , John Stultz , linux-rtc@vger.kernel.org, Jiaxun Yang , Daniel Lezcano , Thomas Gleixner , Alessandro Zummo , Alexandre Belloni , Stephen Boyd , Geert Uytterhoeven , linux-m68k References: <20220115193245.3777833-1-laurent@vivier.eu> <20220115193245.3777833-4-laurent@vivier.eu> From: Laurent Vivier In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:X3raeUWjLbG4Qv47KMacOpNsSNYi+XeJ1v535mvSQI9q5vKvWK/ ohgGS/PrmpSvQ1hbNTCXKp5KzkldAxzyDGdxxyQ/uxXI4u5qObM5/ccaVIlt5kf8jd6Yrxl plPsDC+2JxuR4Cmzh6Y6DPUzDvBckDbAGpi7a3p+2DjbqnSCZKGs8GYyKOCFR8ejkh4nVql 640D6HnWL1HzY/pH7iyuA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:qm+OVm7QkMQ=:9cX7LUVzh36XwM6BDed5Ov sgCqq5kOQzBRNjEA3OK4nBO+t6x4Mk7JKnJlF+I6buSaBxVSRtoo3HJymPf1U5eOoYWiUuKHt DFWwizsC0RS+x1Ra14ajoulm+QG1Bsj/VoCu8UiD6Rg/JD/Rqd/VLfGpygScxtzLIDPyluVAq rxl3+Jd+NHJQRfkVkceLaXIiJ2fkP9JB1vZ8F9l58KUsQEeIN+dE6JUI9N6Av1fH8WTc5PGw1 NoyLO0tjWzVCmtPaSQKOTTBuAg+u20EXFfZnwcf0i+en/lkYw14qEyUpi7rVK0VFxUHjS4jW1 Qhm1Mahrg+CYWnpXuvc5Ba+0EwmMxAka49i+yhgeMjDYf8mHgC3Ak6Ywr/14mWQtbi3gZQydY P/k8VgtF1bdZ5udOsYqye5bfFdADSELtH8nrtiQm2ivNTXAyFc8mAuyrr36FqLmpzVdq33cVf ai1G4LGtpXV62jjProRKWREd2GbLQnC9rlpxXLGWo2f/uSVAI3JoNoC+p6R0nUB3iw2Nyiy13 NiS5zqqA9ZUtcxZwTUMnTX3AwDh4T1FxRzizCAK6hTtdAaPGeyb3OVF8hWWgnspIcAnqG7E6G ww+QZ2uWm0kJV78yK+KOiGNSSg3ofxUnPH/PBPAdnwr+gXEv06Tn9N6umGQOOCQajomom3fpz /dfOT/SDZTpp6tIHmdsl8APCJFfcCkaDRHW8AMs5Vb3DpVKQ9oAM65fh35AeTsTrvbRQ= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 16/01/2022 à 11:44, Arnd Bergmann a écrit : > On Sat, Jan 15, 2022 at 8:32 PM Laurent Vivier wrote: > >> + >> +/* goldfish endianness depends on CPU endianness */ >> +#ifdef CONFIG_CPU_BIG_ENDIAN >> +#define goldfish_ioread32 ioread32be >> +#define goldfish_iowrite32 iowrite32be >> +#else >> +#define goldfish_ioread32 ioread32 >> +#define goldfish_iowrite32 iowrite32 >> +#endif > > This is not what I meant here, as you are breaking big-endian support > for all other > architectures in the process. > > On architectures that support both big-endian and little-endian kernels, devices > (including emulated ones) can't know which type of kernel you are running, so > this has to be fixed by architecture. Ideally this macro should be in > an architecture > specific header file, but you can also just make this a check for m68k and hope > that qemu doesn't duplicate this bug on architectures that gain support for this > driver in the future. Virtio has exactly the same problem in the past (prio to v1.0), and it uses __LITTLE_ENDIAN in virtio_legacy_is_little_endian() to know the endianness of the device. So the code can become: #ifdef __LITTLE_ENDIAN #define goldfish_ioread32 ioread32 #define goldfish_iowrite32 iowrite32 #else #define goldfish_ioread32 ioread32be #define goldfish_iowrite32 iowrite32be #endif What do you prefer: CONFIG_M68K or __LITTLE_ENDIAN? Thanks, Laurent