From: Jani Nikula <jani.nikula@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Promote make_u64 macro to .h file
Date: Wed, 10 Apr 2024 14:40:02 +0300 [thread overview]
Message-ID: <87wmp578fh.fsf@intel.com> (raw)
In-Reply-To: <6498954f-e539-4695-8338-4820d423731b@intel.com>
On Mon, 08 Apr 2024, Michal Wajdeczko <michal.wajdeczko@intel.com> wrote:
> On 14.02.2024 14:36, Jani Nikula wrote:
>> On Tue, 13 Feb 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
>>> On Tue, Feb 13, 2024 at 10:05:43PM +0100, Michal Wajdeczko wrote:
>>>> We shouldn't hide generic macros inside .c files as this may lead
>>>> to unnecessary code duplication if similar functionality is needed
>>>> elsewhere. Promote make_u64 to .h as soon we will want to reuse it.
>>>
>>> On the other hand, we shouldn't create an internal library of macros
>>> that then start to get used indiscriminately as if it was Linux core
>>> helpers.
>>>
>>> Changes like this was how the i915_utils.h started.
>>>
>>> If we really think that this macro is useful somewhere else, then
>>> we should be looking to make that as part of the linux/types.h
>>
>> Agreed.
>>
>> Well, maybe not specifically types.h, but maybe a separate header.
>
> My attempts to promote this to a global macro reached dead end. To move
> forward please either engage in LKML [1] [2] discussions or accept this
> local solution or suggest other option.
Tried to nudge things forward. Fingers crossed.
BR,
Jani.
>
> Michal
>
> [1]
> https://lore.kernel.org/lkml/20240214155408.1569-1-michal.wajdeczko@intel.com/
>
> [2]
> https://lore.kernel.org/lkml/20240214214654.1700-1-michal.wajdeczko@intel.com/
>
>
>>
>> There's a need for something like this:
>>
>> $ git grep "hi[ )]*<< *\(8\|16\|32\)[ )]*|.*lo"
>>
>> Ditto for taking higher/lower half of a variable.
>>
>>
>> BR,
>> Jani.
>>
>>
>>>
>>>>
>>>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>>>> ---
>>>> drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 --
>>>> drivers/gpu/drm/xe/xe_macros.h | 8 ++++++++
>>>> 2 files changed, 8 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>>> index c26e4fcca01e..76a018ec8136 100644
>>>> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>>> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>>>> @@ -557,8 +557,6 @@ static int handle_acc(struct xe_gt *gt, struct acc *acc)
>>>> return ret;
>>>> }
>>>>
>>>> -#define make_u64(hi__, low__) ((u64)(hi__) << 32 | (u64)(low__))
>>>> -
>>>> #define ACC_MSG_LEN_DW 4
>>>>
>>>> static bool get_acc(struct acc_queue *acc_queue, struct acc *acc)
>>>> diff --git a/drivers/gpu/drm/xe/xe_macros.h b/drivers/gpu/drm/xe/xe_macros.h
>>>> index daf56c846d03..b79d775c737e 100644
>>>> --- a/drivers/gpu/drm/xe/xe_macros.h
>>>> +++ b/drivers/gpu/drm/xe/xe_macros.h
>>>> @@ -7,6 +7,7 @@
>>>> #define _XE_MACROS_H_
>>>>
>>>> #include <linux/bug.h>
>>>> +#include <linux/types.h>
>>>>
>>>> #define XE_WARN_ON WARN_ON
>>>>
>>>> @@ -15,4 +16,11 @@
>>>> "Ioctl argument check failed at %s:%d: %s", \
>>>> __FILE__, __LINE__, #cond), 1))
>>>>
>>>> +/**
>>>> + * make_u64 - make u64 value from two u32 values
>>>> + * @hi__: value representing upper 32 bits
>>>> + * @lo__: value representing lower 32 bits
>>>> + */
>>>> +#define make_u64(hi__, low__) ((u64)(hi__) << 32 | (u64)(low__))
>>>> +
>>>> #endif
>>>> --
>>>> 2.43.0
>>>>
>>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-04-10 11:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 21:05 [PATCH] drm/xe: Promote make_u64 macro to .h file Michal Wajdeczko
2024-02-13 21:43 ` ✓ CI.Patch_applied: success for " Patchwork
2024-02-13 21:43 ` ✓ CI.checkpatch: " Patchwork
2024-02-13 21:44 ` ✓ CI.KUnit: " Patchwork
2024-02-13 21:55 ` ✓ CI.Build: " Patchwork
2024-02-13 21:56 ` ✗ CI.Hooks: failure " Patchwork
2024-02-13 21:58 ` ✓ CI.checksparse: success " Patchwork
2024-02-13 22:19 ` [PATCH] " Rodrigo Vivi
2024-02-14 13:36 ` Jani Nikula
2024-04-08 12:20 ` Michal Wajdeczko
2024-04-10 11:40 ` Jani Nikula [this message]
2024-02-13 22:20 ` ✓ CI.BAT: success for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wmp578fh.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).