Skip to content

Conversation

@adamgreloch
Copy link
Member

@adamgreloch adamgreloch commented May 23, 2025

JIRA: RTOS-1034

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @adamgreloch, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello, gemini-code-assist here, providing a summary of this pull request. This PR addresses an issue where the ioctl(KIOEN) request was not being handled by the UART drivers for the grlib-multi and mcxn94x-multi platforms. The changes introduce specific logic within the UART device control handlers to intercept the KIOEN request and use it to enable or disable kernel logging via the libklog_enable function. This functionality is restricted to the UART device configured as the console.

Highlights

  • Handle KIOEN ioctl: The primary change is the addition of specific handling for the KIOEN ioctl request within the UART device control message processing.
  • Kernel Log Control: The KIOEN ioctl is now used to control the state (enable/disable) of kernel logging by calling libklog_enable.
  • Console UART Specific: The KIOEN functionality is intentionally limited to only affect the UART device that is configured as the system console.

Changelog

  • multi/grlib-multi/uart.c
    • Added include for <libklog.h> on line 21.
    • Modified the uart_ioctl function (lines 339-354) to check if the request is KIOEN. If so, it calls libklog_enable if the device is the console UART, otherwise returns -EINVAL. If not KIOEN, it falls back to libtty_ioctl.
  • multi/mcxn94x-multi/uart.c
    • Modified the uart_handleMsg function within the mtDevCtl case (lines 352-363) to check if the request is KIOEN. If so, it calls libklog_enable if the minor device corresponds to the console UART, otherwise returns -EINVAL. If not KIOEN, it falls back to libtty_ioctl.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


An ioctl call,
Unandled, caused a fall.
Now KIOEN works,
Fixing all the quirks,
Logging stands up tall.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces handling for the KIOEN ioctl command in the UART drivers for grlib-multi and mcxn94x-multi. The changes allow enabling or disabling kernel log output via this ioctl, specifically on designated console UARTs. The core logic added to both drivers appears sound and correctly restricts the KIOEN functionality to the appropriate console device.

I have a couple of points for clarification and a request regarding the pull request description.

Summary of Findings

  • Pull Request Description: The pull request description template is currently unfilled. Providing details on the motivation, context (e.g., what issue does unhandled KIOEN cause?), and testing methodology would greatly benefit the review process and future maintainability.
  • Clarity of KIOEN ioctl argument: The code uses (int)(intptr_t)inData to pass the argument to libklog_enable(). While this is a common pattern for ioctls passing small integer values, it would be good to confirm this is the intended contract for the KIOEN ioctl's input data.

Merge Readiness

The code changes themselves for handling KIOEN appear logically sound and correctly implemented for both UART drivers. However, before merging, I recommend addressing the following:

  1. Complete the Pull Request Description: Please fill in the template with details about the motivation, context, and testing for this change.
  2. Clarify inData Convention (Optional but Recommended): A brief confirmation or pointer to documentation regarding the expected format of inData for KIOEN would be helpful for future reference, though the current implementation follows a common pattern.

Due to the incomplete pull request description, I am requesting changes. I am not authorized to approve pull requests; please ensure further review and approval as per your team's policy once the requested information is provided.

@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-1034 branch from 367cc7e to 24b05b2 Compare May 23, 2025 08:32
@github-actions
Copy link

github-actions bot commented May 23, 2025

Unit Test Results

7 958 tests   7 434 ✅  40m 36s ⏱️
  470 suites    524 💤
    1 files        0 ❌

Results for commit 7444c85.

♻️ This comment has been updated with latest results.

@adamgreloch adamgreloch marked this pull request as ready for review May 23, 2025 09:15
@adamgreloch adamgreloch requested review from Darchiv and nalajcie May 23, 2025 09:16
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.

2 participants