Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xaie_helper.c : fix calloc error with GCC 14 #13

Open
wants to merge 1,042 commits into
base: main-aie
Choose a base branch
from

Conversation

Byvirven
Copy link

Fix transposed calloc arguments for compatibility with GCC 14

Corrected the order of arguments in calloc calls in xaie_helper.c to resolve
compilation errors with GCC 14.2.1 (-Werror=calloc-transposed-args).

  • Updated XAie_Txn_MergeSync to use calloc(1, sizeof(tct_op_t)).
  • Updated XAie_Txn_DdrAddressPatch to use calloc(1, sizeof(patch_op_t)).

Problem solved by the commit

These changes eliminate errors caused by transposed arguments GCC 14 with the calloc function,
ensuring proper memory allocation and alignment. In previous versions of GCC, this was a simple
warning but now it is critical errors.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

The problem was identified while attempting to compile xdna-driver with GCC 14.2.1 under
Fedora 41 with kernel 6.11.8

How problem was solved, alternative solutions (if any) and why they were rejected

The first solution to fix the problem is to use the "-disable-werror" argument of the build.sh script
when compiling xdna npu-xrt library.

The second solution, more stable, has to respect the order of the calloc parameters (the number of
consecutive elements to allocate and the size of an element, in our case, a struct), therefore 1x8 bytes
in the first one and 1x36 bytes the second one instead of 8x1 and 36x1.

Risks (if any) associated the changes in the commit

The risks are minimal and it has been adopted in different branches.

What has been tested and how, request additional testing if necessary

  • Success build with GCC 14.2.1 of XDNA drivers under Fedora 41 powered by kernel 6.11.8
  • Basic XDNA test files passed with success

Documentation impact (if any)

I'ld be delighted if any real documentation was available...

Keerthanna Mohan and others added 30 commits February 7, 2023 04:41
Added an api to classify the tile type of aie2ps.

Signed-off-by: Keerthanna Mohan <[email protected]>

Sankarji Goaplakrishnan
…fer for MaskPoll

Adds check for the autoflush flag in the transaction buffer for
XAie_MaskPoll() operation. If flag isn't checked some APIs such
XAie_LockAcquire() will stall as it is not flushing the transaction
buffer.

Signed-off-by: Gregory Williams <[email protected]>

Acked-by: Hua Jiang<[email protected]>
…roInit

Fixed compiler warning by adding return value to the _XAie_LPartDataMemZerInit.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-by:Hua Jiang<[email protected]>
CHANNEL_RUNNING bits also needs to be checked for this register.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Acked-by:Hua Jiang<[email protected]>
Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Acked-by:Hua Jiang<[email protected]>
Xaie_DMaWaitforDone fix causes issues for AIE2P/AIE2PS as some of the
code of AIEML is reused, those are fixed.

Signed-off-by: Sankarji Gopalakrishnan <[email protected]>

Acked-by:
Currently we have two channel running variable ChannelRunning and
Channel_running. Remove Channel_running to keep the coding style
consistent.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Sankarji Gopalakrishnan
Add missing ;

Signed-off-by: Govindarajulu Varadarajan <[email protected]>
Fixes: 7112933 ("aiefal: test: updated group event tests for Memtile")

Acked-by: Hua Jiang<[email protected]>
This reverts commit d934d80.

This test case is not fal test case. Plan is to create new test
directory under driver and add driver test cases there.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Acked-by: Hua Jiang<[email protected]>
…lL1IrqId"

This reverts commit f8187b1.

Commit f8187b1 ("driver: src: interrupt: Fix relative loc in
_XAie2Ipu_IntrCtrlL1IrqId") fixes the l2 mask issue on IPU. But this
breaks the relocatability of cdo to other columns. By default for IPU,
cdo is generated for col 1. The same cdo is used for other columns as
well.

In the future, we'll use the start column in DevInst in backtrack
function to determine the L1 controller to L2 mask. For this, the user
needs to pass us the correct DevInst->StartCol in the backtrack
function.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Acked-by: Hua Jiang<[email protected]>
Removed additional lines in copyright.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-by: Hua Jiang<[email protected]>
set/clear shim clk and column clk buffer for the
given set of columns.

Signed-off-by: Sankarji Gopalakrishnan <[email protected]>

Acked-by: Hua Jiang<[email protected]>
Fixed compilation issue for IPU which was introduced while adding shim clk API.

Signed-off-by: Sankarji Gopalakrishnan <[email protected]>

acked
…lock.

Signed-off-by: Sankarji Gopalakrishnan <[email protected]>

Acked-by: Hua Jiang<[email protected]>
check the size of buffer correctly before reallocating the transaction
buffer.

Signed-off-by: Tejus Siddagangaiah <[email protected]>

Signed-off-by: Gregory Williams <[email protected]>
Relavent changes in Linux Kernel is required to handle shim dma in
transaction mode

Signed-off-by: Kishan Gondaliya <[email protected]>

Signed-off-by: Gregory Williams <[email protected]>
This API will configure group error0 into error halt register for
all architecture. So whenever any event will occur in group_error0,
core will be in halt state. By putting core in halt, useful register
can be read for debugging purpose.

Signed-off-by: Keyur Parekh <[email protected]>
------
BRANCH: main
CR-1148392
-----

Signed-off-by: Gregory Williams <[email protected]>
add utest code for test procedure reference

Signed-off-by: siyuan sun <[email protected]>

BRANCH: main, main-aie
SSW: 4644

Acked-by: Hua Jiang<[email protected]>
Fixes issue where tiles in use bitmap is not updated correctly when
calling XAie_PmRequestTiles on AIEML devices.

Signed-off-by: Gregory Williams <[email protected]>

Acked By:Hua Jiang<[email protected]>
The trace timeline has inconsistencies if the array tiles are left
ungated by XAie_PartitionInitialize(). As per the trace analyzer, the
inconsistency here is that a core on (24, 1) tile is being enabled
before (8, 1).  This is a temporary workaround to unblock rel-v2023.1.
The root cause of this issue hasn't been established yet, but gating the
tiles before returning from XAie_PartitionInitialize() seems to hide the
underlying issues in the tools.

Signed-off-by: Gregory Williams <[email protected]>

Acked-By: Hua Jiang<[email protected]>
Adds API to read and parse data from buffer descriptor registers. Also
adds API to get the number of buffer descriptors per tile.

Signed-off-by: Gregory Williams <[email protected]>

Sankarji Gopalakrishnan
Added A0 and B0 support in the hardware configuration.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-By:Hua Jiang<[email protected]>
Modifying each columns to use one irq id instead of current design of AIE2P A0
columns 0 and 1 use the same Irq Id.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-By:Hua Jiang<[email protected]>
Adds API to get performace counter register offset given a tile and
counter number.

Signed-off-by: Gregory Williams <[email protected]>

Acked-By: Hua Jiang<[email protected]>
XAie_LPartGetNextNocTile() return absolute tile location. So the Loc
will have value {0, 1}. In the for loop, we check 1 < 1 since
DevInst->NumCol is 1 and we never enter the for loop.

Also Call to _XAie_PrivilegeSetL2IrqId() takes relative loc as argument.

Change all the tile loc to relative loc.

Signed-off-by: Govindarajulu Varadarajan <[email protected]>

Acked-By: Hua Jiang<[email protected]>
Added support to parse event status register values.
Added multi-column start partition support to XAie_LGetColRangeStatus API.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-By: Hua Jiang<[email protected]>
Compiling the driver with -ftree-pre and -fthread-jumps is causing and
infinite while loop. We have observed that replacing logic with the for
loop avoids this behavior. This is a work around so we can continue to
build driver with complete set of -O2 optimizations. Further debugging
of this issue will be required.

Signed-off-by: Gregory Williams <[email protected]>

Sankarji Gopalakrishnan
Fixing the compiler warnings.

Signed-off-by: Keerthanna Mohan <[email protected]>

Acked-By: Hua Jiang<[email protected]>
Updates version for 2023.1 release from 3.2 to 3.3.

Signed-off-by: Gregory Williams <[email protected]>

Acked-By:Hua Jiang<[email protected]>
Update aiefal to version 1.4 for 2023.1 release

Signed-off-by: Gregory Williams <[email protected]>

Sankarji Gopalakrishnan
Keyur Parekh and others added 29 commits August 28, 2024 11:42
In Timer configuration, wrong module was passed
while configuring for MemTile. And becuase of that
Timer sync was failing.

Signed-Off-By: Keyur Parekh <[email protected]>
…ce (#461)

generation specific reginit file for missing device generations.

This CL contains the code changes identified as part of fixing
CR-1205532. It contains following changes:
    1) Enhanced the XAie_DmaChStatus structure definitions to initialize
       TaskOverFlow fields which were missed out for most of the device
       generations like 2IPU and 2P.

Signed-off-by: Koteswara Rao Reddy <[email protected]>
…uild issues. (#462)

This CL contains following changes:
   1) Export the two recently added TXN public APIs XAie_Txn_Preempt and
      XAie_Txn_NoOp to enable windows AIE compiler builds.

Signed-off-by: Koteswara Rao Reddy <koteswararao.reddy!amd.com>
Building FAL code in windows environment
generates warnings. Based on compiler options
warnings are treated as errors. So fixing warning
will avoid build failures.

Signed-Off-By: Keyur Parekh <[email protected]>
Modify Timer Sync API to use two broadcast
channel. With one broadcast channel, shim tiles
were not syncing. To make sure all tiles sync
at same time using two broadcast channel.

Signed-Off-By: Keyur Parekh <[email protected]>
Added new support not to clear L2 memory in case of
preemption. In this preemption case, need to preserve
L2 memory data, so while doing context clear, avoid
clearing L2 memory if user don't want to clear it.

Signed-Off-By: Keyur Parekh <[email protected]>
This CL contains following code changes:
   1) Fixed the wrong invocation of low level API for Busy Variant
      of XAie_LockReleaseBusy API.

Signed-off-by: Koteswara Rao Reddy <[email protected]>
This patch handles the change of API name from XAie_ConfigMemTilesMemInterleaving
to XAie_ConfigMemInterleaving. In legacy devices only Mem tile used to support
memory interleaving but in AIE4 and greater devices the AIE tile PM also
supports memory interleaving. So API name changed to generic.

Functional logic still works only for legAacy devices. as this release/main_aig
doesnt support AIE4 device code yet

Signed-off-by: Ramanjaneyulu Uppari <[email protected]>
To Check available space in DMA BD Task queue,
needs to check 3 bit value to see if there is one
space available to queue next packet. This logic has
problem of bit shift. This PR fixes that logic to
get correct value to see available space in DMA
Channel Queue.

CR-Fixed: 1195888

Signed-Off-By: Keyur Parekh <[email protected]>
…r error (#553)

This CL contains following code changes:
    1) Fix the BW Buffer Size to include XAie_BlockWrite32Hdr size in
       bytes when BW Buffer is emnpty. So that the condition to check
       if BW Buffer needs to be doubled or not can be fixed.

Signed-by-off: Koteswara Rao Reddy [email protected]
…ding.

This CL contains following code changes:
    1) Fix the bug in _XAie_DataMemoryBlockWrite() function to create
       correct sequence of maskwrites and blockwrites to handle loading
       of unaligned (w.r.t word boundary) data sections of core elfs.

Signed-off-by: Koteswara Rao Reddy <[email protected]>
This patch contains below
1.added function to check precision for left and right shifts
2.fixes INT31-C, INT34-C, HFA etc CERT-C issues

Signed-off-by: Sandeep Elkapelly <[email protected]>
"Windows Compilation Fix - Pointer Typecasting Correction (#578)"
"drv:src:Fix CERT-C issues"

Co-authored-by: Ladage <[email protected]>
In AIE array before switching to the new application New
transaction needs to be stopped. So this API will set bit
into shim tile register to stop all new Memory transaction.
And added finite timeout to make sure all transaction has
been finished and new application is good to load.

In current AIE2p architecture there is no way from HW to see
if any pending transaction is available or not, so added
finite delay after setting register in Hardware.

Signed-Off-By: Keyur Parekh <[email protected]>
This CL contains following code changes:
    1) Added dummy implementation of XAie_AddressPatching() for non
       AIE4 device generations.

Signed-Off-By: Koteswara Rao Reddy <[email protected]>
This CL contains following code changes:
   1) Fix the return value of XAie_AddressPatching() API from
      XAIE_NOT_SUPPORTED to XAIE_FEATURE_NOT_SUPPORTED

Signed-Off-By: Koteswara Rao Reddy <[email protected]>
…h GCC 14

Corrected the order of arguments in calloc calls in `xaie_helper.c` to resolve
compilation errors with GCC 14 (`-Werror=calloc-transposed-args`).

- Updated `XAie_Txn_MergeSync` to use `calloc(1, sizeof(tct_op_t))`.
- Updated `XAie_Txn_DdrAddressPatch` to use `calloc(1, sizeof(patch_op_t))`.

These changes eliminate errors caused by transposed arguments in calloc,
ensuring proper memory allocation and alignment.

Signed-off-by: Marco Dos Santos Oliveira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.