Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp52240rdb; Fri, 5 Jan 2024 02:23:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0qS/60g2BfJ/bxsoj9vPgFTzeg20O9MJaL+viV8bLpLhYPjb3BlVtpWq3eQH/RLqql3WW X-Received: by 2002:a17:902:e549:b0:1d4:c2ad:4e59 with SMTP id n9-20020a170902e54900b001d4c2ad4e59mr2267494plf.71.1704450182572; Fri, 05 Jan 2024 02:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704450182; cv=none; d=google.com; s=arc-20160816; b=AgxeuZ/buBki+LZ+lvh7KTO5JiGzINtr2Wr44UPwVHkqSTVWTCQyC9PD/epcIL65CF OelFlNHktmIrL927Tq312xIB249KUI6BQLeRheAcfbLeQOjpy1I9md4GCNZBy+rP9bgh qi18sRs3xJJO4s+AhqwGPwTWZaH/Kaig7CMfqdvo/Hx8n/3hGZiRwZ1MKHjUPduipq8V LSAx7LFEs2h49w9peM8lQkbqIH5n3cDFN4OtYdpexUwNrUtBkp45I5awAKD8mp4mgttn Zgq3pp3TGqRo+cTB3BD/vFEQxYdJHKY0FZ0k0+Yn5zLKPDC98gjKVqkDmqH74wmu9VSW V3jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Otn9loBBsw/UzqwebEZy3Ooa0CujzEAcJwFz8Zj1BXs=; fh=AaoJ2qg+AZ360a2OwGtJ0+VIfECIw0oMObnCdp3KJ5U=; b=lKfYQvDGzuejXa8u/wOj6szHIqy1J50b6lfPfmNkxlKnUjAvt9lp6HMeiUBK/QZQu9 6ZgUcHM/atRk445Lb0H6blVQ/YufW7GaqCqSU/iqTn7hs4mJcqcnHhQ4wjkZVFu5QicP ntmO23tbZbomSDliPqnOtLdQmWw9iXAQqs4gGyT9g8PYY5dT5LanJvDH2XX946mpXZv0 m06zlSATNB5elm4voCcI3C56zkS8Y3LAxP3XfBg0HFL5z6bs3FT5t9QsakyRLV9gkru8 i8ZNy7DIsCilLztgk6hZBFo/932ggfyxDTRMNt3gC9IER9b89j0ZjhxV9rquafGA7T92 vpfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dOFAPwkS; spf=pass (google.com: domain of linux-kernel+bounces-17740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d5-20020a170902b70500b001d4af7a3cd3si977135pls.83.2024.01.05.02.23.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 02:23:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dOFAPwkS; spf=pass (google.com: domain of linux-kernel+bounces-17740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CB55D283677 for ; Fri, 5 Jan 2024 10:23:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B498250F4; Fri, 5 Jan 2024 10:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dOFAPwkS" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3560928E20 for ; Fri, 5 Jan 2024 10:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2cd1aeb1b02so16911691fa.2 for ; Fri, 05 Jan 2024 02:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704450169; x=1705054969; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Otn9loBBsw/UzqwebEZy3Ooa0CujzEAcJwFz8Zj1BXs=; b=dOFAPwkSAsJq5YJUiju4J4fVJz0ZZ0Ky14HRIGt40H8EG8j+SXQVMFUUPmE1PGDfsd wmGVc9s2cytmOHs83v1AY5GlxQqu4zXrB7ic70u71nFRkU5wVSkMRLUBpVbzM2ZHfcRy gMDDroO+8usoVtxCxb9xQV/9H/Ky2W1tSOfAXxoBlX4/MrfkCmESsjnLj/NicbL8sVV4 cl7pgnGN63tNP8A78galhMAh9rZsobnRg1PjqGZaUp3mRMOmNOV+//cQbbmhZlledYCh r1lB1AXZZDON/hnwU/8ZRrhwGGqnS33FfxNsZaxgPL7TCzXlZ0LrxoAkMxCEU90Y1F8B uwKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704450169; x=1705054969; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Otn9loBBsw/UzqwebEZy3Ooa0CujzEAcJwFz8Zj1BXs=; b=UOMm6M7dLEkMyQ1DARyVVKiAQo9nbtTfxocq2K6s0ydeGNpaSSUyss1ssvYhsk1nqL PIB7bhXmCr/tod6MknkoIWcqMGUiJs5a7iyhEKvoX6K85T8dAfqWVOv90GM6hP/uoyEu 4y5GCSPIFuY1WdbU0c5M48iYJD/Ut9Hdu1TeHaV3jl7VxEc5DHZ6aIsOd0wjeK0lzyfS DABjU8ndyz93nOEIARnnVqwYMyskAYzVLlIUrnTROrqJ6CqXMISdkpP0+XMS+n3TlzHa LNBC3gnuQmciBoJV78WvVdvmiJWdSW+DU1xtw4psQPV6KamixyixBWux3ec5UkbwvMbM vy+Q== X-Gm-Message-State: AOJu0Ywgn/l0f9Tu5b+g/o9klYdLmkH5fIzZ2wGjn5wRntagy8pV5sgD yY5OXtRqeU+TfD8y4LDXEiT76WMgEvx/9g== X-Received: by 2002:a2e:a9a2:0:b0:2cc:6bf6:cdc6 with SMTP id x34-20020a2ea9a2000000b002cc6bf6cdc6mr1295046ljq.7.1704450169091; Fri, 05 Jan 2024 02:22:49 -0800 (PST) Received: from [192.168.2.107] ([79.115.63.202]) by smtp.gmail.com with ESMTPSA id ek21-20020a056402371500b0055732bd1fc0sm474638edb.82.2024.01.05.02.22.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jan 2024 02:22:48 -0800 (PST) Message-ID: <19746c85-6eff-4f63-9370-9592ad73f22c@linaro.org> Date: Fri, 5 Jan 2024 10:22:46 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 04/12] tty: serial: samsung: prepare for different IO types Content-Language: en-US To: Greg KH Cc: peter.griffin@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, mturquette@baylibre.com, sboyd@kernel.org, conor+dt@kernel.org, andi.shyti@kernel.org, alim.akhtar@samsung.com, jirislaby@kernel.org, s.nawrocki@samsung.com, tomasz.figa@gmail.com, cw00.choi@samsung.com, arnd@arndb.de, semen.protsenko@linaro.org, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-serial@vger.kernel.org, kernel-team@android.com References: <20231228125805.661725-1-tudor.ambarus@linaro.org> <20231228125805.661725-5-tudor.ambarus@linaro.org> <2024010432-taco-moneyless-53e2@gregkh> <2024010450-heritage-variety-d72d@gregkh> From: Tudor Ambarus In-Reply-To: <2024010450-heritage-variety-d72d@gregkh> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/4/24 15:56, Greg KH wrote: > On Thu, Jan 04, 2024 at 03:41:28PM +0000, Tudor Ambarus wrote: >> >> >> On 1/4/24 15:32, Greg KH wrote: >>> On Thu, Dec 28, 2023 at 12:57:57PM +0000, Tudor Ambarus wrote: >>>> GS101's Connectivity Peripheral blocks (peric0/1 blocks) which >>>> include the I3C and USI (I2C, SPI, UART) only allow 32-bit >>>> register accesses. If using 8-bit register accesses, a SError >>>> Interrupt is raised causing the system unusable. >>>> >>>> Instead of specifying the reg-io-width = 4 everywhere, for each node, >>>> the requirement should be deduced from the compatible. >>>> >>>> Prepare the samsung tty driver to allow IO types different than >>>> UPIO_MEM. ``struct uart_port::iotype`` is an unsigned char where all >>>> its 8 bits are exposed to uapi. We can't make NULL checks on it to >>>> verify if it's set, thus always set it from the driver's data. >>>> >>>> Signed-off-by: Tudor Ambarus >>>> --- >>>> v2: new patch >>>> >>>> drivers/tty/serial/samsung_tty.c | 9 ++++++++- >>>> 1 file changed, 8 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c >>>> index 66bd6c090ace..97ce4b2424af 100644 >>>> --- a/drivers/tty/serial/samsung_tty.c >>>> +++ b/drivers/tty/serial/samsung_tty.c >>>> @@ -72,6 +72,7 @@ struct s3c24xx_uart_info { >>>> const char *name; >>>> enum s3c24xx_port_type type; >>>> unsigned int port_type; >>>> + unsigned char iotype; >>>> unsigned int fifosize; >>>> unsigned long rx_fifomask; >>>> unsigned long rx_fifoshift; >>> >>> Is there a reason you are trying to add unused memory spaces to this >>> structure for no valid reason? I don't think you could have picked a >>> more incorrect place in there to add this :) >>> >>> Please fix. >>> >> >> Will put it after "const char *name". > > If you do, spend some time with the tool, pahole, and see if that's > really the best place for it or not. Might be, might not be, but you > should verify it please. > Thanks! I played with pahole a bit. For arm32 this struct is not as bad defined as for arm64, all members fit in the same cacheline. There are some holes though and 2 cachelines for arm64 where this struct needs some love. The best and minimum invasive change for my iotype member would be to put it before the "has_divslot" member, as the has_divslot bitfield will be combined with the previous field. But I think the entire struct has to be reworked and the driver butchered a bit so that we get to a better memory footprint and a single cacheline. I volunteer to do this in a separate patch set so that we don't block this series. I think the final struct can look as following: struct s3c24xx_uart_info { const char * name; /* 0 8 */ enum s3c24xx_port_type type; /* 8 4 */ unsigned int port_type; /* 12 4 */ unsigned int fifosize; /* 16 4 */ u32 rx_fifomask; /* 20 4 */ u32 rx_fifoshift; /* 24 4 */ u32 rx_fifofull; /* 28 4 */ u32 tx_fifomask; /* 32 4 */ u32 tx_fifoshift; /* 36 4 */ u32 tx_fifofull; /* 40 4 */ u32 clksel_mask; /* 44 4 */ u32 clksel_shift; /* 48 4 */ u32 ucon_mask; /* 52 4 */ u8 def_clk_sel; /* 56 1 */ u8 num_clks; /* 57 1 */ u8 iotype; /* 58 1 */ u8 has_divslot:1; /* 59: 0 1 */ /* size: 64, cachelines: 1, members: 17 */ /* padding: 4 */ /* bit_padding: 7 bits */ }; This looks a lot better than what we have now: /* size: 120, cachelines: 2, members: 17 */ /* sum members: 105, holes: 2, sum holes: 8 */ /* sum bitfield members: 1 bits (0 bytes) */ /* padding: 4 */ /* bit_padding: 23 bits */ /* last cacheline: 56 bytes */ I'll put iotype before has_divslot and then follow up with a patch set to clean the driver. Cheers, ta